Files
ubicloud/prog/github
Jeremy Evans 1e74e8f1eb Switch from FOR UPDATE to DELETE ... WHERE to handle race condition in Prog::Github::GithubRepositoryNexus#cleanup_cache
FOR UPDATE locks the returned rows (up to 200) while deleting each.
This causes additional latency in the runtime route. Avoid locking
the rows, but add a filter when deleting each row.  If the row no
longer matches the filter used when the row was SELECTed, do not
delete it.

This uses Sequel's instance_filters plugin to allow for additional
conditions in the DELETE statement (beyond the primary key filter).
It then adds destroy_where dataset and instance methods, which
use the arguments to setup the instance filter.

This requires transactions/savepoints around each DELETE statement,
so the DELETE process is now slower.  However, the #cleanup_cache
method is not sensitive to latency (unlike the runtime route),
so this shouldn't cause a problem.
2025-03-28 09:31:41 -07:00
..