Skip to content

Commit 112fdee

Browse files
Improve delay, change greylist clean
1 parent e67e98c commit 112fdee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/WorkflowCore/Services/BackgroundTasks/WorkflowConsumer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ protected override async Task ProcessItem(string itemId, CancellationToken cance
3535
Logger.LogInformation("Workflow locked {0}", itemId);
3636
return;
3737
}
38-
38+
3939
WorkflowInstance workflow = null;
4040
WorkflowExecutorResult result = null;
41-
41+
4242
try
4343
{
4444
cancellationToken.ThrowIfCancellationRequested();
@@ -77,9 +77,9 @@ protected override async Task ProcessItem(string itemId, CancellationToken cance
7777
}
7878
}
7979
}
80-
80+
8181
}
82-
82+
8383
private async Task SubscribeEvent(EventSubscription subscription, IPersistenceProvider persistenceStore, CancellationToken cancellationToken)
8484
{
8585
//TODO: move to own class
@@ -100,8 +100,8 @@ private async Task SubscribeEvent(EventSubscription subscription, IPersistencePr
100100
int attempt = 0;
101101
while (!acquiredLock && attempt < 10)
102102
{
103-
acquiredLock = await _lockProvider.AcquireLock(eventKey, cancellationToken);
104103
await Task.Delay(Options.IdleTime, cancellationToken);
104+
acquiredLock = await _lockProvider.AcquireLock(eventKey, cancellationToken);
105105

106106
attempt++;
107107
}
@@ -112,9 +112,9 @@ private async Task SubscribeEvent(EventSubscription subscription, IPersistencePr
112112
}
113113
else
114114
{
115+
_greylist.Remove(eventKey);
115116
await persistenceStore.MarkEventUnprocessed(evt, cancellationToken);
116117
await QueueProvider.QueueWork(evt, QueueType.Event);
117-
_greylist.Remove(eventKey);
118118
}
119119
}
120120
finally

0 commit comments

Comments
 (0)