It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started.
Created attachment 189567 [details] [review] Bug 41248: Add ability for real time holds queue background jobs to skip duplicate jobs (edit) It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started. Test Plan: 1) Enable real time holds queue 2) Ensure the default queue background job worker is not running 3) Set up 2 or more holds for the record 4) Alter the priority for those holds a couple times 5) Confirm only one new job is in the background_jobs table for that record.
It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started. Test Plan: 1) Enable real time holds queue 2) Ensure the default queue background job worker is not running 3) Set up 2 or more holds for the record 4) Alter the priority for those holds a couple times 5) Confirm only one new job is in the background_jobs table for that record.
Created attachment 189569 [details] [review] Bug 41248: Add unit tests
Created attachment 189570 [details] [review] Bug 41248: Add ability for real time holds queue background jobs to skip duplicate jobs It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started. Test Plan: 1) Enable real time holds queue 2) Ensure the default queue background job worker is not running 3) Set up 2 or more holds for the record 4) Alter the priority for those holds a couple times 5) Confirm only one new job is in the background_jobs table for that record.
Created attachment 189571 [details] [review] Bug 41248: Add unit tests Patch from commit fadb037
Created attachment 189581 [details] [review] Bug 41248: Add ability for real time holds queue background jobs to skip duplicate jobs It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started. Test Plan: 1) Enable real time holds queue 2) Ensure the default queue background job worker is not running 3) Set up 2 or more holds for the record 4) Alter the priority for those holds a couple times 5) Confirm only one new job is in the background_jobs table for that record. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 189582 [details] [review] Bug 41248: Add unit tests Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Failing QA until supply a follow-up patch to add an index to background_jobs.data. On a server with 762052 background_jobs entries, the queries take over 1.5 seconds each, which seems like a long time to me.
Created attachment 189593 [details] [review] Bug 41248: Add index on background_jobs.data Index decreases search result time from 1.6 seconds to 0.001 seconds on 153,205 rows Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 189594 [details] [review] Bug 41248: Add index on background_jobs.data Index decreases search result time from 1.6 seconds to 0.001 seconds on 153,205 rows Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>