Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jobqueue: Thread safety fixes #977

Merged
merged 1 commit into from
Jan 20, 2018
Merged

jobqueue: Thread safety fixes #977

merged 1 commit into from
Jan 20, 2018

Conversation

tsnoam
Copy link
Member

@tsnoam tsnoam commented Jan 19, 2018

  • Fix JobQueue.jobs to obtain a lock on the internal queue object prior
    to iterating over it.

  • Rename JobQueue.queue to JobQueue._queue. This shouldn't be
    accessible by the user directly, but rather only with sanitized
    thread safe methods.

  • JobQueue.interval_seconds - access self.interval only once to avoid
    race conditions.

Fixes #968

 - Fix JobQueue.jobs to obtain a lock on the internal queue object prior
   to iterating over it.

 - Rename JobQueue.queue to JobQueue._queue. This shouldn't be
   accessible by the user directly, but rather only with sanitized
   thread safe methods.

 - JobQueue.interval_seconds - access self.interval only once to avoid
   race conditions.
@tsnoam tsnoam changed the title jobqueue: Thread safety fixes - Fixes #968 jobqueue: Thread safety fixes Jan 19, 2018
@Eldinnie
Copy link
Member

Looks good. But why not directly integrate #934 in this?

@tsnoam
Copy link
Member Author

tsnoam commented Jan 20, 2018

@Eldinnie Yes it's possible.

@tsnoam
Copy link
Member Author

tsnoam commented Jan 20, 2018

@Eldinnie Actually #934 is not complete. Still missing unitests.
I'll merge tihs PR and we'll wait for the author of #934 to add unitests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JobQueue.jobs() is not thread safe
2 participants