mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
more aggressively skip perform API when threads are closing
This commit is contained in:
@@ -341,8 +341,9 @@ class Account(object):
|
||||
def shutdown(self, wait=True):
|
||||
""" stop threads and close and remove underlying dc_context and callbacks. """
|
||||
if hasattr(self, "_dc_context"):
|
||||
self.stop_threads(wait=False) # to interrupt idle and tell python threads to stop
|
||||
lib.dc_close(self._dc_context)
|
||||
self.stop_threads(wait=wait)
|
||||
self.stop_threads(wait=wait) # to wait for threads
|
||||
deltachat.clear_context_callback(self._dc_context)
|
||||
del self._dc_context
|
||||
|
||||
@@ -392,12 +393,18 @@ class IOThreads:
|
||||
def imap_thread_run(self):
|
||||
while not self._thread_quitflag:
|
||||
lib.dc_perform_imap_jobs(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_imap_fetch(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_imap_idle(self._dc_context)
|
||||
|
||||
def smtp_thread_run(self):
|
||||
while not self._thread_quitflag:
|
||||
lib.dc_perform_smtp_jobs(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_smtp_idle(self._dc_context)
|
||||
|
||||
|
||||
|
||||
@@ -468,7 +468,7 @@ impl Imap {
|
||||
|
||||
fn unsetup_handle(&self, context: &Context) {
|
||||
info!(context, 0, "IMAP unsetup_handle starts");
|
||||
self.interrupt_idle();
|
||||
// self.interrupt_idle();
|
||||
let session = self.session.lock().unwrap().0.take();
|
||||
if session.is_some() {
|
||||
match session.unwrap().close() {
|
||||
|
||||
Reference in New Issue
Block a user