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

Identical events not handled properly, not sure if intentional #486

Open
v3rm0n opened this issue Jan 31, 2024 · 1 comment
Open

Identical events not handled properly, not sure if intentional #486

v3rm0n opened this issue Jan 31, 2024 · 1 comment

Comments

@v3rm0n
Copy link

v3rm0n commented Jan 31, 2024

If I publish one event multiple times then

UPDATE EVENT_PUBLICATION
			SET COMPLETION_DATE = ?
			WHERE
					LISTENER_ID = ?
					AND SERIALIZED_EVENT = ?

Will update completion date on all of the records in the database: ones already completed and ones not even processed yet.

Should there be a unique constraint on listener_id and serialized_event or probably a better way to find the current record to update?

Actually stumbled upon this one by getting deadlocks when sending a lot of identical events and was wondering how a simple create then update once can deadlock :)

EDIT: I understand that modulith tries to guarantee at least once delivery so it doesn't break that but I still have that feeling that this could be handled in a more transparent way, would failing to process an identical event be considered bad?

@v3rm0n
Copy link
Author

v3rm0n commented Feb 1, 2024

So I'm thinking at minimum there should be a check for COMPLETION_DATE to be NULL so that history does not get changed.
Also maybe LIMIT 1 but this is less important since it doesn't affect at least once behaviour.

I'm willing to contribute if what I'm saying actually makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant