Skip to content

Commit 87d0c98

Browse files
authored
Fix to my previous TimerListener changes (#793)
1 parent 8f36569 commit 87d0c98

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/WebJobs.Extensions/Extensions/Timers/Listener/TimerListener.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,17 @@ internal async Task HandleTimerEvent()
267267
/// <param name="runOnStartup">True if the invocation is because the timer is configured to run on startup.</param>
268268
internal async Task InvokeJobFunction(DateTime invocationTime, bool isPastDue = false, bool runOnStartup = false, DateTime? originalSchedule = null)
269269
{
270-
await _invocationLock.WaitAsync();
271-
272-
// if Cancel, Stop, or Dispose have been called, skip the invocation
273-
// since we're stopping the listener
274-
if (_cancellationTokenSource.IsCancellationRequested)
275-
{
276-
return;
277-
}
278-
279270
try
280271
{
272+
await _invocationLock.WaitAsync();
273+
274+
// if Cancel, Stop, or Dispose have been called, skip the invocation
275+
// since we're stopping the listener
276+
if (_cancellationTokenSource.IsCancellationRequested)
277+
{
278+
return;
279+
}
280+
281281
CancellationToken token = _cancellationTokenSource.Token;
282282
ScheduleStatus timerInfoStatus = null;
283283
if (ScheduleMonitor != null)

0 commit comments

Comments
 (0)