diff --git a/coolamqp/cluster.py b/coolamqp/cluster.py index ab366e5d778e9fee0623963e37cd3d82f36eacb3..084663ae38e3b27cde92c440361fdf39bc747fef 100644 --- a/coolamqp/cluster.py +++ b/coolamqp/cluster.py @@ -211,15 +211,15 @@ class Cluster(object): self.thread.start() return self - def shutdown(self, complete_outstanding_tasks=False): + def shutdown(self, complete_remaining_tasks=False): """ Cleans everything and returns. - :param complete_outstanding_tasks: if set to True, pending operations will be completed. + :param complete_remaining_tasks_tasks: if set to True, pending operations will be completed. If False, thread will exit without completing them. This can mean that if the cluster doesn't come up online, shutdown MAY BLOCK FOREVER. """ - self.thread.complete_outstanding_upon_termination = complete_outstanding_tasks + self.thread.complete_remaining_upon_termination = complete_remaining_tasks self.thread.terminate() self.thread.join() # thread closes the AMQP uplink for us diff --git a/coolamqp/handler.py b/coolamqp/handler.py index fd32f62c552d9bd59c0a0c320ca4cdf53906a9e7..e98dbc12bc0140ed0bdd02367677c6bcfa2a20c7 100644 --- a/coolamqp/handler.py +++ b/coolamqp/handler.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) class _ImOuttaHere(Exception): """Thrown upon thread terminating. - Thrown only if complete_outstanding_upon_termination is False""" + Thrown only if complete_remaining_upon_termination is False""" class ClusterHandlerThread(threading.Thread): @@ -32,7 +32,7 @@ class ClusterHandlerThread(threading.Thread): self.cluster = cluster self.is_terminating = False - self.complete_outstanding_upon_termination = False + self.complete_remaining_upon_termination = False self.order_queue = collections.deque() # queue for inbound orders self.event_queue = queue.Queue() # queue for tasks done self.connect_id = -1 # connectID of current connection @@ -81,7 +81,7 @@ class ClusterHandlerThread(threading.Thread): self.backend = None # good policy to release resources before you sleep time.sleep(exponential_backoff_delay) - if self.is_terminating and (not self.complete_outstanding_upon_termination): + if self.is_terminating and (not self.complete_remaining_upon_termination): raise _ImOuttaHere() exponential_backoff_delay = min(60, exponential_backoff_delay * 2)