question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

self.publish doesn't work in an infinite loop

See original GitHub issue

I 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:open
  • Created 8 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sametmaxcommented, Jul 24, 2015

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.

0reactions
sametmaxcommented, Aug 22, 2015

Pretty much 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found