you are blocking the main thread reactor of the callee component by running a tight computational loop. You probably want to run this loop on a background thread - on a multi-core machine, to actually achieve parallel/concurrent computation.
Try something like this:
from twisted.internet.threads import deferToThread
log = Logger()
def onJoin(self, details):
res = 0
for x in range(0, 50000):
# computing ...
res += param * x
return deferToThread(test, param)
yield self.register(wrap_test, 'com.test')
PS: don't use "print" in tests like these .. this goes to console, and there are a lot of unrelated effects that can result from that.
Am 10.11.2016 um 22:28 schrieb Bla zej:
I have this situation: one registered RPC procedure in backend file that
for test purposes simulates some long computing (about 5 sec.) and two
clients that call that procedure in onJoin and print result (source files
attached). I run these clients in 2-3 sec. intervals and what happens is
that first client receives result only when backend finishes processing
call from second client. In other words, client1 and client2 receive result
at the same time but logically client1 should get result 2-3 sec. earlier?
Am I doing something wrong or does corssbar work like this?