self.publish doesn't work in an infinite loop
See original GitHub issueI have this code :
class MyComponent(ApplicationSession):
def onConnect(self):
self.join("realm1")
@inlineCallbacks
def onJoin(self, details):
for x in range(100):
yield self.publish('foo', 'bar')
And it works : I can read the event on all the clients.
Now if I do :
class MyComponent(ApplicationSession):
def onConnect(self):
self.join("realm1")
@inlineCallbacks
def onJoin(self, details):
while True:
yield self.publish('foo', 'bar')
I don’t get any event on any client. Is it too fast and flooding the router ? In that case shouldn’t find a way to handle it by processing them batch by batch ?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
python 3.x - Why ROS Publisher doesn't work without a loop?
Publish doesn't need a loop to work. This function send only one message. Test : Launch your subscriber, then launch your publisher.
Read more >Publish one message without while infinite loop - ROS Answers
Hi all, I am using ROS Noetic. I tried to publish one message without "while infinite loop" in the node that I created....
Read more >C#'s infinite loops explained (+ causes & solutions) - Kodify.net
A C# infinite loop runs forever and freezes our app. They can happen by accident, or with while we can make them deliberately....
Read more >paho - Unable to publish MQTT server in an infinite while loop ...
publish () calls work because you build up a queue of messages to be published, then the on_connect() returns and the thread can...
Read more >How to Solve the Infinite Loop of React.useEffect()
A pitfall you might experience when working with useEffect() is the infinite loop of component renderings. In this post, I'll describe the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for this very insightful answer.
I do think it’s an important issue to fix. I tried to demonstrate crossbar to a friends working in a big american python shop and basically ended up making a fool of myself, spending half an hour trying to fix a non existent bug.
Given that error reporting with autobahn is lacking, at best, it made the experience quite frustrating because I couldn’t find what I was doing wrong. Combined with the usual gotchas (not calling connect() in JS or forgetting that publishers don’t receive their own publication by default), I had 0 thing working and no clue why for a looooog time.
Now, as a crossbar fan, I’m willing to encounter these problems and deal with it, but somebody trying by himself will just throw the product in a trash bin.
Pretty much 😃