From 7458995eee98a239911c0a0f379551adc6bf823b Mon Sep 17 00:00:00 2001 From: Ingo Meyer Date: Mon, 4 Apr 2022 13:06:13 +0200 Subject: Do not fail in the idler stop method on connection drops On connection drops or standby events, sending a `noop` command is not possible, and leads to a failing `stop` method in the `Idler` class. This commit adds a try/except block to ignore that error case, since it is not relevant for the `stop` method. --- ayatanawebmail/idler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ayatanawebmail') diff --git a/ayatanawebmail/idler.py b/ayatanawebmail/idler.py index 3e852a1..b6b63b4 100755 --- a/ayatanawebmail/idler.py +++ b/ayatanawebmail/idler.py @@ -23,8 +23,11 @@ class Idler(object): def stop(self): if self.oConnection.oImap is not None: - # Send a NOOP command to interrupt the IDLE mode and free the blocked thread - self.oConnection.oImap.noop() + try: + # Send a NOOP command to interrupt the IDLE mode and free the blocked thread + self.oConnection.oImap.noop() + except: + pass self.oEvent.set() def join(self): -- cgit v1.2.3