Skip to content

Slightly rework causal_diff_queue insertion logic #99

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

Merged
merged 2 commits into from
Jun 18, 2025

Conversation

mitchellwrosen
Copy link
Contributor

Overview

@ChrisPenner and I accidentally discovered today that the real culprit behind an INSERT ON CONFLICT DO NOTHING into causal_diff_queue blocking is not due to a row lock taken by SELECT FOR UPDATE, but rather the eager DELETE of the selected row.

So, we decided to simply move the DELETE call to after a worker has finished computing a namespace diff, significantly reducing the time window during which a concurrent INSERT might block.

This also lets us implement the "on get contribution diff, if missing, insert into work queue" which is convenient to have for a number of minor reasons, including that we can wipe precomputed diffs out of namespace_diffs whenever we need to, since we are no longer relying on creating or updating a contribution being the only actions that trigger a diff computation.

@ChrisPenner ChrisPenner merged commit 5b370e9 into main Jun 18, 2025
4 checks passed
@ChrisPenner ChrisPenner deleted the on-demand-enqueue branch June 18, 2025 16:14
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

Successfully merging this pull request may close these issues.

2 participants