@@ -103,14 +103,19 @@ private async Task Execute()
103103 }
104104 if ( hasTask )
105105 {
106- _secondPasses . Add ( item ) ;
107- if ( ! EnableSecondPasses )
108- await QueueProvider . QueueWork ( item , Queue ) ;
106+ // _secondPasses.Add(item);
107+
108+ // Rescheduling the workflow if it is already running its last step of execution leads to NRE in
109+ // RedisPersistenceProvider. See https://github.com/danielgerlag/workflow-core/issues/1376
110+ // Until a better solution is found, we will disable it as well as second passes in general as they are only
111+ // used for Index and Event Consumers, and we don't use them.
112+
113+ // if (!EnableSecondPasses)
114+ // await QueueProvider.QueueWork(item, Queue);
109115 activity ? . Dispose ( ) ;
110116 continue ;
111117 }
112-
113- _secondPasses . TryRemove ( item ) ;
118+ // _secondPasses.TryRemove(item);
114119
115120 var waitHandle = new ManualResetEvent ( false ) ;
116121 lock ( _activeTasks )
@@ -171,11 +176,11 @@ private async Task ExecuteItem(string itemId, EventWaitHandle waitHandle, Activi
171176 try
172177 {
173178 await ProcessItem ( itemId , _cancellationTokenSource . Token ) ;
174- while ( EnableSecondPasses && _secondPasses . Contains ( itemId ) )
175- {
176- _secondPasses . TryRemove ( itemId ) ;
177- await ProcessItem ( itemId , _cancellationTokenSource . Token ) ;
178- }
179+ // while (EnableSecondPasses && _secondPasses.Contains(itemId))
180+ // {
181+ // _secondPasses.TryRemove(itemId);
182+ // await ProcessItem(itemId, _cancellationTokenSource.Token);
183+ // }
179184 }
180185 catch ( OperationCanceledException )
181186 {
0 commit comments