14 |
14 |
15 def run(self,f,*args,**kwargs): |
15 def run(self,f,*args,**kwargs): |
16 """To run a function in Twisted's thread pool""" |
16 """To run a function in Twisted's thread pool""" |
17 return threads.deferToThreadPool(self.reactor, self.pool, f, *args, **kwargs) |
17 return threads.deferToThreadPool(self.reactor, self.pool, f, *args, **kwargs) |
18 |
18 |
|
19 #task Pool for sending |
19 taskPool = Pool('task',5) |
20 taskPool = Pool('task',5) |
|
21 |
|
22 #db Pool to handle reqests to sqlalchemy |
20 dbPool = Pool('database',5) |
23 dbPool = Pool('database',5) |
21 |
24 |
22 |
25 # all pools in one list |
23 pools=[taskPool,dbPool] |
26 pools=[taskPool,dbPool] |
24 |
27 |
25 def startPool(reactor): |
28 def startPool(reactor): |
26 '''starting all pools''' |
29 '''starting all pools''' |
27 for pool in pools: |
30 for pool in pools: |