def get_message(self, message_store, message_id): self.fetch[message_id] = Deferred() d = succeed(None) if self.pause_after > 0: self.pause_after -= 1 else: if not self.pause_d.called: self.pause_d.callback(None) d.addCallback(lambda _: self.resume_d) d.addCallback(lambda _: InboundResource.get_message(self, message_store, message_id)) d.addCallback(self._finish_fetching) return d
def get_message(self, message_store, message_id): d = succeed(None) if self.pause_after > 0: self.pause_after -= 1 else: if not self.pause_d.called: self.pause_d.callback(None) d.addCallback(lambda _: self.resume_d) d.addCallback(lambda _: InboundResource.get_message( self, message_store, message_id)) d.addCallback(self.add_fetched) return d
def get_message(self, message_store, message_id): self.fetch[message_id] = Deferred() d = succeed(None) if self.pause_after > 0: self.pause_after -= 1 else: if not self.pause_d.called: self.pause_d.callback(None) d.addCallback(lambda _: self.resume_d) d.addCallback(lambda _: InboundResource.get_message( self, message_store, message_id)) d.addCallback(self._finish_fetching) return d
def __init__(self, *args, **kw): InboundResource.__init__(self, *args, **kw) self.pause_after = 3 self.pause_d = Deferred() self.resume_d = Deferred() self.fetch = {}