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

worker_active logic can be replaced with a break instead #239

Open
notirl opened this issue Aug 21, 2018 · 4 comments
Open

worker_active logic can be replaced with a break instead #239

notirl opened this issue Aug 21, 2018 · 4 comments

Comments

@notirl
Copy link

notirl commented Aug 21, 2018

In the workers for running regular measurements we have a worker_active variable. This isn't ever useful afaict as as soon as it's set to false and if statement causes the loop to end anyway.

There's a wait at the end of the loop which doesn't seem to serve any purpose. Maybe we can just remove this.

@irl
Copy link
Member

irl commented Aug 26, 2018

Looking at this more, it's actually more complicated. Probably we should draw out what this state machine looks like before messing with it.

@mirjak
Copy link
Contributor

mirjak commented Aug 27, 2018

I think the wait is there to make sure that no new jobs come in. Currently I think we load all jobs at the beginning and then never add any additional ones later but as far as I understood this was originally designed to also be able to stream input...

@irl
Copy link
Member

irl commented Aug 27, 2018

You can feed jobs in until you send the shutdown sentinel. The issue here is that it is sleeping after the shutdown sentinel has been received before terminating the thread. There's not really anything else that the worker can do because after the sleep it will just die anyway.

I think this is a left-over from the synchronised spider where we wanted to keep all workers alive until the end to be able to spin the semaphores, but I can't be sure yet.

@mirjak
Copy link
Contributor

mirjak commented Aug 27, 2018

Okay. Was just guess which wait you meant...

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

No branches or pull requests

3 participants