diff --git a/fluent/asynchandler.py b/fluent/asynchandler.py index 397608e..e3c3dc0 100644 --- a/fluent/asynchandler.py +++ b/fluent/asynchandler.py @@ -8,19 +8,3 @@ class FluentHandler(handler.FluentHandler): def getSenderClass(self): return asyncsender.FluentSender - - def close(self): - self.acquire() - try: - try: - self.sender.close() - finally: - super().close() - finally: - self.release() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.close() diff --git a/fluent/handler.py b/fluent/handler.py index 1018d69..8029604 100644 --- a/fluent/handler.py +++ b/fluent/handler.py @@ -264,7 +264,9 @@ def close(self): self.acquire() try: try: - self.sender.close() + if self._sender is not None: + self._sender.close() + self._sender = None finally: super().close() finally: