Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Worker may have a race-condition when accepting work #6

@drigz

Description

@drigz

I'm not sure how rowcount is set, so when Worker goes to update a work item as being taken by it, it assumes that of two concurrent executions of:

UPDATE uploaded SET state=1 WHERE state=0 AND id=1;
COMMIT;

after the commit, one cursor will have rowcount=1 and one will have rowcount=0. However, this may not be true, but I'm not sure how to correctly implement a queue removal like this in SQL, or even if it's a sensible thing to try.

An alternative would be to use Python's multiprocessing.Queue, but this is not particularly important while load is low...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions