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

[BUG] BookmarksDeleted notification not send on index (Elsa 2.14.1) #5408

Open
punk88 opened this issue May 17, 2024 · 1 comment
Open

[BUG] BookmarksDeleted notification not send on index (Elsa 2.14.1) #5408

punk88 opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@punk88
Copy link

punk88 commented May 17, 2024

Description

On indexing bookmarks there are no any notifications BookmarksDeleted for removed bookmarks

Steps to Reproduce

execute method IndexBookmarksAsync() in class BookmarkIndexer.cs

This method removes oldBookmarks and creates new(bookmarks):

entities.AddRange(bookmarks);

await _bookmarkStore.AddManyAsync(entities, cancellationToken);
var oldBookmarkIds = oldBookmarks.Select(x => x.Id).ToList();
await _bookmarkStore.DeleteManyAsync(new BookmarkIdsSpecification(oldBookmarkIds), cancellationToken);
await _publisher.Publish(new BookmarksDeleted(workflowInstanceId, bookmarks), cancellationToken);
_logger.LogDebug("Deleted {DeletedBookmarkCount} bookmarks for workflow {WorkflowInstanceId}", bookmarks.Count, workflowInstanceId); 
await _publisher.Publish(new BookmarkIndexingFinished(workflowInstanceId, bookmarks), cancellationToken);

But BookmarksDeleted notification sends NOT for oldBookmarks, but for 'entities' - bookmars that created.

Is it bug at code?
May be correct code is:
await _publisher.Publish(new BookmarksDeleted(workflowInstanceId, oldBookmarks), cancellationToken);

Expected Behavior

BookmarksDeleted send for deleted bookmars

Actual Behavior

BookmarksDeleted don't send for actually deleted bookmars

@punk88 punk88 added the bug Something isn't working label May 17, 2024
Copy link

glime-ai bot commented May 17, 2024

Based on the context provided, it appears that there is a potential issue with the BookmarkIndexer.cs method IndexBookmarksAsync() in the Elsa Workflow library. The issue described is that the BookmarksDeleted notification is being published with the new bookmarks (entities) instead of the old bookmarks (oldBookmarks) that are actually being deleted.

The expected behavior, as described, is that the BookmarksDeleted notification should be sent for the deleted bookmarks (oldBookmarks). If the notification is being sent with the new bookmarks instead, this could indeed be a bug.

The correct code, according to the expected behavior, should be:

await _publisher.Publish(new BookmarksDeleted(workflowInstanceId, oldBookmarks), cancellationToken);

This would ensure that the BookmarksDeleted notification is sent for the bookmarks that are actually being removed from the store.

If you are experiencing this issue, it would be advisable to report it to the maintainers of the Elsa Workflow library so they can investigate and address the potential bug. You can do this by creating an issue on the official Elsa GitHub repository.

This comment was generated by Glime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant