mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
we were running into issues where multiple beats queue up the run_scheduled_jobs task at the same time, and concurrency issues with selecting scheduled jobs causes both tasks to trigger processing of the job. Use with_for_update, which calls through to the postgres SELECT ... FOR UPDATE which locks other SELECT FOR UPDATES (ie other threads running same code) until the rows are set to pending and the transaction completes - so the second thread will not find any rows