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

Timer work on master process or every process? #759

Closed
caichudong opened this issue Mar 26, 2022 · 2 comments
Closed

Timer work on master process or every process? #759

caichudong opened this issue Mar 26, 2022 · 2 comments

Comments

@caichudong
Copy link

caichudong commented Mar 26, 2022

I test the code timer just run once, how should i be sure the timer run on master process?

`
from nameko.timer import timer
my_cache = 0.0

class Service:
name ="service"
@Timer(interval=2)
def add(self):
global my_cache
mycache = mycache+1
print(mycache)
`

@aryatalathi
Copy link

Can I work on this issue? Waiting for a reply. Thank you.

@mattbennett
Copy link
Member

It's unclear what you mean by "master process".

The add method on the service you've written will execute every two seconds while the service is running. As with all entrypoints, each execution will happen in its own worker thread.

I'll close this issue. If you still have questions, the forum is a better place to ask them.

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

No branches or pull requests

3 participants