From 0fcbe4a211da460a52a27b0ba713ceab2be6ec48 Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Wed, 11 Jan 2017 12:25:18 +0100 Subject: [PATCH] forking! --- coolamqp/attaches/declarer.py | 1 - coolamqp/clustering/cluster.py | 2 ++ coolamqp/uplink/listener/thread.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/coolamqp/attaches/declarer.py b/coolamqp/attaches/declarer.py index 00dafb3..54ecee7 100644 --- a/coolamqp/attaches/declarer.py +++ b/coolamqp/attaches/declarer.py @@ -9,7 +9,6 @@ import logging from coolamqp.framing.definitions import ChannelOpenOk, ExchangeDeclare, ExchangeDeclareOk, QueueDeclare, \ QueueDeclareOk, ChannelClose from coolamqp.attaches.channeler import Channeler, ST_ONLINE, ST_OFFLINE -from coolamqp.uplink import PUBLISHER_CONFIRMS, MethodWatch, FailWatch from coolamqp.attaches.utils import AtomicTagger, FutureConfirmableRejectable, Synchronized from coolamqp.objects import Future, Exchange, Queue, Callable diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py index a0a5f44..1834eb8 100644 --- a/coolamqp/clustering/cluster.py +++ b/coolamqp/clustering/cluster.py @@ -27,6 +27,8 @@ class Cluster(object): This has ListenerThread. Call .start() to connect to AMQP. + + It is not safe to fork() after .start() is called, but it's OK before. """ # Events you can be informed about diff --git a/coolamqp/uplink/listener/thread.py b/coolamqp/uplink/listener/thread.py index 6e5d2dc..887ecba 100644 --- a/coolamqp/uplink/listener/thread.py +++ b/coolamqp/uplink/listener/thread.py @@ -17,12 +17,12 @@ class ListenerThread(threading.Thread): threading.Thread.__init__(self, name='coolamqp/ListenerThread') self.daemon = True self.terminating = False - self.listener = EpollListener() def terminate(self): self.terminating = True def run(self): + self.listener = EpollListener() while not self.terminating: self.listener.wait(timeout=1) self.listener.shutdown() -- GitLab