summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-12-09 11:04:40 -0500
committerJason R. Coombs <jaraco@jaraco.com>2018-12-09 11:04:40 -0500
commit65305d812b5a2db0535d3272bb62399b19377f48 (patch)
tree3c062569475bb7d418369c6d95c642835211d6c7
parent4515443ffb0db6f00da60b7a74c4ce08f5db8406 (diff)
downloadcherrypy-git-65305d812b5a2db0535d3272bb62399b19377f48.tar.gz
Use always_iterable in Bus.wait
-rw-r--r--cherrypy/process/wspbus.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cherrypy/process/wspbus.py b/cherrypy/process/wspbus.py
index 1f1d6577..5b19b827 100644
--- a/cherrypy/process/wspbus.py
+++ b/cherrypy/process/wspbus.py
@@ -81,6 +81,8 @@ import warnings
import subprocess
import functools
+from more_itertools import always_iterable
+
# Here I save the value of os.getcwd(), which, if I am imported early enough,
# will be the directory from which the startup script was run. This is needed
@@ -368,10 +370,7 @@ class Bus(object):
def wait(self, state, interval=0.1, channel=None):
"""Poll for the given state(s) at intervals; publish to channel."""
- if isinstance(state, (tuple, list)):
- states = state
- else:
- states = [state]
+ states = set(always_iterable(state))
while self.state not in states:
time.sleep(interval)