Hi here is an example of my project, I would like to use nameko run Test:A
,
And I find that the class A will be inital repeatedly during run this service.
Actuallly,I want to connect to a service and do something repeat and I don't want to initial the connection every time. So is there any good method to solve this?
###FileName:Test.py###
from nameko.timer import timer
import time
class A:
name = 'test'
def __init__(self):
self.a = 'a'
print('this class has been init')
@timer(interval=0)
def test(self):
try:
print('this is a nameko method')
except:
pass
time.sleep(1)
@timer(interval=2)
def test2(self):
try:
print('second nameko method')
except:
pass
time.sleep(3)```