Steal WorkerActivities from other processes in initialize_activity
Closes #1357 (closed)
While removing the activity-stealing abilities of UpdateWorkerActivity
, I noticed that no tests failed at all, so I first fixed a test so that it broke, and then updated the test again.
I could not use Django's conflict handling at all simply because we do not use bulk_create
at all, as we need an INSERT … SELECT
and not a regular bulk create. The ON CONFLICT
clause I had to use could never have worked with Django anyway as I needed an index predicate to match the relevant unique constraint, and a WHERE
on the update itself to prevent stealing activities that were processed or started, as that would defeat the point of worker activities (don't run on what you already processed!).