turkle icon indicating copy to clipboard operation
turkle copied to clipboard

Improve efficiency of locking tasks when doing assignment

Open cash opened this issue 4 years ago • 0 comments

See comment on #117

The functions of interest are accept_next_task() and _skip_aware_next_available_task_id().

The flow is

  1. lock all tasks that the user has access to
  2. 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.

cash avatar Feb 17 '21 21:02 cash