Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish should be called when the state is changed #1759

Merged
merged 2 commits into from Dec 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,9 @@
v18.1.0
-------

* :issue:`1758` via :pr:`1759`: In the bus, when awaiting a
state change, only publish after the state has changed.

v18.0.1
-------

Expand Down
2 changes: 1 addition & 1 deletion cherrypy/process/wspbus.py
Expand Up @@ -375,7 +375,7 @@ def wait(self, state, interval=0.1, channel=None):

while self.state not in states:
time.sleep(interval)
self.publish(channel)
self.publish(channel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: I've checked magicbus and it also has publish inside of the loop.
https://github.com/cherrypy/magicbus/blob/master/magicbus/base.py#L335

cc @aminusfu

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible this was just an error that was propagated to other libraries? Is there a commit somewhere where that was specifically added?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea.. It's a huge wholesale decade old commit: f5d026c#diff-be33a4f55d59dfc70fc6452482f3a7a4R291. Sure it got into magicbus after cherrypy.

But it's hard to guess what was the reason for putting it like this. That's why I'm tagging guys who might know better.

cc @jaraco


def _do_execv(self):
"""Re-execute the current process.
Expand Down