internal void UpdateScheduleDueTime() { var now = TimeProvider.GetCurrentTime(); lock (_lock) { if (_isDisposed) { _logger.Warning( $"Rejected attempt to update schedule due time of an exposed '{this.GetType().FullName}'.", nameof(UpdateScheduleDueTime)); return; } try { _scheduleDueTime = _schedule.GetDueTimeAfter(now.AddTicks(1)); if (_scheduleDueTime < now) { _logger.Warning( "Due time is earlier than current time. Due time is changed to 'never'.", nameof(UpdateScheduleDueTime)); _scheduleDueTime = JobExtensions.Never; } else if (_scheduleDueTime > JobExtensions.Never) { _logger.Warning( "Due time is later than 'never'. Due time is changed to 'never'.", nameof(UpdateScheduleDueTime)); _scheduleDueTime = JobExtensions.Never; } } catch (Exception ex) { _scheduleDueTime = JobExtensions.Never; _logger.Warning( "An exception was thrown on attempt to calculate due time. Due time is changed to 'never'.", nameof(UpdateScheduleDueTime), ex); } } }