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 possible bug in add-xid-whitelist logic #1785

Merged
merged 4 commits into from Apr 17, 2024

Conversation

ballPointPenguin
Copy link
Contributor

I'm still (after all these years) a relative clojure n00b, BUT it seems to me that this logic discards the first batch of xids when upserting the whitelist.
e.g. If I give it a list of 200 xids, only 51-200 will be upserted and the first 50 discarded.

Does this make sense?

@metasoarous
Copy link
Member

Good catch! I think it's actually dropping the final batch of comments, not the first. But yes, this is a bug.

I'd recommend sticking with the partial implementation, as it's a bit more clojuric in this case. But not a big deal either way.

@metasoarous
Copy link
Member

Actually, I think what we really want is (when (seq xids-batch) ...), since I'm not sure that we want to execute an upsert if the batch is empty for some reason. I don't know off the top of my head if that would result in a pg error, but maybe better on the safe side.

@ballPointPenguin
Copy link
Contributor Author

Confirmed that the original bug is dropping the final batch of XIDs, and that this change fixes that bug.

@ballPointPenguin ballPointPenguin merged commit 85ce00f into edge Apr 17, 2024
2 checks passed
@ballPointPenguin ballPointPenguin deleted the br/add-xid-whitelist branch April 17, 2024 17:55
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.

None yet

2 participants