GitLab replaces redundant each_batch query in Maven snapshot cleanup with direct slice updates

A GitLab contributor reworked the Maven snapshot cleanup code, which marks old package files for later deletion. The original code used each_batch on slices of at most 200 ids, which always produced a single batch and so ran two unnecessary lookup queries per slice. The fix replaces this with a direct update_all on each slice, following a pattern already used elsewhere in the same service. The change preserves the batch deadline check, which still stops long cleanups on time, and the count of updated rows. The change was tracked in issue #639257 and merged as merge request !270142 after a database review using production query plans.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in