Kombu callback for each `drain_events` loop iteration.
547363
def on_iteration(self):
        
        self._cancel_consumers_if_requested()

        if len(self._consumers) == 0:
            _log.debug('requesting stop after iteration')
            self.should_stop = True
623373
def process_callbacks(event_type, event_data)
      @callbacks[event_type].each do |callback|
        fiber = Fiber.new do
          begin
            callback.call(event_data)
          rescue => e
            @loggers.error "-- #{e.class}: #{e.message}"
            e.backtrace.each { |line| @loggers.error("-- #{line}") }
          end
        end

        # If the callback has a :defer option, call it in a thread
        # from the EM thread pool. Else call it in the reactor thread.
        if callback.options[:defer]
          EM.defer(fiber.resume)
        else
          fiber.resume
        end
      end
    end
173688
public void flushPendingSessionEvents() throws Exception {
        synchronized (sessionEventsQueue) {
            IoSessionEvent evt;
            
            while ((evt = sessionEventsQueue.poll()) != null) {
                logger.debug(" Flushing buffered event: {}", evt);    
                evt.deliverEvent();
            }
        }
    }
21820
def events(self, argv):
        """"""
        opts = cmdline(argv, FLAGS_EVENTS)
        self.foreach(opts.args, lambda job: 
            output(job.events(**opts.kwargs)))
535928
def drain(self, tab_key):
		'''
		
		'''
		self.log.debug("Draining transport")
		ret = []
		while len(self.messages[tab_key]):
			ret.append(self.messages[tab_key].pop(0))

		self.log.debug("Polling socket")

		tmp = self.___recv(tab_key)
		while tmp is not None:
			ret.append(tmp)
			tmp = self.___recv(tab_key)

		self.log.debug("Drained %s messages", len(ret))
		return ret
292066
def process_events(args):
    """"""
    client = EventsClient.from_config()
    client.set_debug(True)
    if args.get:
        response = client.get_events()
    elif args.flush:
        response = client.flush_events()
    return response
867698
@Override
    public T drain() {
        T event = delayed.drain();
        if (event != null) {
            return event;
        }

        return source.drain();
    }
725871
public static void callOnIsPrefetchChanged(
      @Nullable List<ProducerContextCallbacks> callbacks) {
    if (callbacks == null) {
      return;
    }
    for (ProducerContextCallbacks callback : callbacks) {
      callback.onIsPrefetchChanged();
    }
  }
165279
def stream_events(self, filter: Callable[[Event], bool] = None, *, max_queue_size: int = 0):
        """"""
        return stream_events([self], filter, max_queue_size=max_queue_size)
1198396
def _run_done_callbacks(self):
        ''' 
        '''
        with self._callbacks_lock:
            for callback in self._done_callbacks:
                try:
                    callback()
                # We do not want a callback interrupting the process, especially
                # in the failure cleanups. So log and catch, the excpetion.
                except Exception as ex:
                    logger.error("Exception: %s" % str(ex))
                    logger.error("Exception raised in %s." % callback, exc_info=True)

            self._done_callbacks = []
995139
def filter_callbacks(cls, client, event_data):
        """"""

        for event in cls.filter_events(client, event_data):
            for cb in event.callbacks:
                yield cb
5673
def update_callback(self, handle, events):
        """"""
        if self._poll is None:
            raise RuntimeError('poll instance is closed')
        if not has_callback(self, handle):
            raise ValueError('no such callback')
        if events & ~(READABLE|WRITABLE):
            raise ValueError('illegal event mask: {}'.format(events))
        if handle.extra == events:
            return
        if handle.extra & READABLE:
            self._readers -= 1
        if handle.extra & WRITABLE:
            self._writers -= 1
        if events & READABLE:
            self._readers += 1
        if events & WRITABLE:
            self._writers += 1
        handle.extra = events
        self._sync()
609390
def run_socket_event_loop(self):
        '''  '''
        try:
            while True:
                self._pool.join()

                # If we have no loggers we'll sleep briefly to ensure that we
                # allow other processes (I.e., the webserver) to do their work.
                if len(self._logger_data.keys()) == 0:
                    time.sleep(0.5)

        except KeyboardInterrupt:
            pass
        finally:
            self._pool.kill()
208777
def callback(event, buffer = nil, start = nil, the_end = nil)
      return if !start.nil? && start == the_end
      if @callbacks.has_key? event
        @callbacks[event].call(buffer, start, the_end)
      end
    end
1202958
def _flush_events(self):
        """"""
        if self._sink is not None:
            for event in self._pending_events:
                self._sink.receive(event)
        self._pending_events = []
125027
function flushEvents() {
  var tmp = PENDING_QUEUE;
  PENDING_QUEUE = [];
  for (var i = 0; i < tmp.length; i++) {
    clientObj.send('log', tmp[i].item, tmp[i].fn);
  }
}
886735
def drain(self):
        
        if self.__container_nodes:
            raise ValueError("Attempted to drain without ending all containers.")
        for buf in self.__depth_traverse(self.__root):
            if buf is not None:
                yield buf
        self.__reset()