I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, ten calls to session.publish()
are ignored until the script is done. As soon as the script finishes, all ten messages are published in a flood.
I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during its run as expected).
The script in question is long, complex and includes a combined frontend and backend for Crossbar/Twisted/AutobahnPython. I feel I would risk misreporting the problem if I tried to condense and include it here.
What reasons are there for publish to not happen instantaneously?
A couple of unsuccessful tries so far:
- Source: Twisted needs 'non-blocking code'. So, I try to incorporate
reactor.callLater
but without success (I also don't really know how to do this for apublish
event). - I looked into the idea of using Pool to spawn workers to perform the publish.
- The AutobahnPython repo doesn't seem to have any examples that really include this kind of situation.
Thanks!