turkle
turkle copied to clipboard
Improve efficiency of locking tasks when doing assignment
See comment on #117
The functions of interest are accept_next_task() and _skip_aware_next_available_task_id().
The flow is
- lock all tasks that the user has access to
- retrieve first task that the user has access to and is not in the skipped list
_skip_aware_next_available_task_id() is also used in preview_next_task() which does not lock.
One option is to move the lock into _skip_aware_next_available_task_id(). Because preview_next_task() is not done in a transaction, the lock won't occur. It will for accept_next_task() and it can be done to only lock one row instead of all the rows.