Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix event greylist stuck #786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/WorkflowCore/Services/BackgroundTasks/EventConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected override async Task ProcessItem(string itemId, CancellationToken cance
if (!await _lockProvider.AcquireLock($"evt:{itemId}", cancellationToken))
{
Logger.LogInformation($"Event locked {itemId}");
await QueueProvider.QueueWork(itemId, QueueType.Event);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this cause a poison message?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line may be. Actually it looks like adding to a queue when failing to acqure an evt lock is a bad idea. But it is necessary when failing to acquire a workflow lock.

return;
}

Expand Down Expand Up @@ -107,6 +108,7 @@ private async Task<bool> SeedSubscription(Event evt, EventSubscription sub, Hash
if (!await _lockProvider.AcquireLock(sub.WorkflowId, cancellationToken))
{
Logger.LogInformation("Workflow locked {0}", sub.WorkflowId);
await QueueProvider.QueueWork(evt.Id, QueueType.Event);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ private async void PollRunnables(object target)
if (_greylist.Contains($"evt:{item}"))
{
_logger.LogDebug($"Got greylisted event {item}");
_greylist.Add($"evt:{item}");
continue;
}
_logger.LogDebug($"Got unprocessed event {item}");
Expand Down