def doStop(self, cv=None): """ Stops imap service (fetcher, factory and port). :param cv: A condition variable to which we can signal when imap indeed stops. :type cv: threading.Condition :return: a Deferred that stops and flushes the in memory store data to disk in another thread. :rtype: Deferred """ if DO_PROFILE: log.msg("Stopping PROFILING") pr.disable() pr.dump_stats(PROFILE_DAT) ServerFactory.doStop(self) if cv is not None: def _stop_imap_cb(): logger.debug('Stopping in memory store.') self._memstore.stop_and_flush() while not self._memstore.producer.is_queue_empty(): logger.debug('Waiting for queue to be empty.') # TODO use a gatherResults over the new/dirty # deferred list, # as in memorystore's expunge() method. time.sleep(1) # notify that service has stopped logger.debug('Notifying that service has stopped.') cv.acquire() cv.notify() cv.release() return threads.deferToThread(_stop_imap_cb)
def doStop(self): """ Stops imap service (fetcher, factory and port). """ # mark account as unusable, so any imap command will fail # with unauth state. self.theAccount.end_session() # TODO should wait for all the pending deferreds, # the twisted way! if DO_PROFILE: log.msg("Stopping PROFILING") pr.disable() pr.dump_stats(PROFILE_DAT) return ServerFactory.doStop(self)
def doStop(self): return ServerFactory.doStop(self)
def doStop(self): """ Stops imap service (fetcher, factory and port). """ return ServerFactory.doStop(self)
def doStop(self): debug( "Stopping factory." ) ServerFactory.doStop(self)
def doStop(self): self.wrappedFactory.doStop() ServerFactory.doStop(self)