Set up the AutoMergeProcessWorker to accept a hash as a param instead of an integer
What does this MR do and why?
1. Adds flexible param handling to the job
This MR sets up the AutoMergeProcessWorker to accept a hash parameter so we can add different kinds of IDs (pipeline_id) in !167095 (merged).
Following the Sidekiq development guidelines, we can change the default param type to Hash (in %17.5), add a type check (in %17.5), and then start using the Hash for other keys in the next milestone (%17.6).
2. Sets up the worker to (optionally) accept multiple ids
In this interest of future flexibility, the handling of merge_request_id and pipeline_id has been refactored so that the value can be either an integer id or an array of integer ids. This uses the same design/strategy as id_in and ActiveRecord's where(id: ), and so should be a fairly unsurprising behavior.
3. Moves all the write queries to the very end of the job
This is a performance optimization. Since we set this worker's data consistency to "sticky", it's now beneficial to shift as many of the read queries as possible to the front of the job, before any writes happen. Doing this will ensure that those reads are executed against one of our Postgres replicas instead of the primary.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
No behavioral changes expected.