Completes the ghost process.

@param \Phergie\Irc\Event\ServerEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
482165
public function handleGhost(ServerEvent $event, Queue $queue)
    {
        if ($this->ghostNick === null) {
            return;
        }

        // Attempt to kill the ghost connection
        $queue->ircPrivmsg($this->botNick, 'GHOST ' . $this->ghostNick . ' ' . $this->password);
    }
160505
public void runMoreOrStop(AsyncEvent<K> _event) {
    for (;;) {
      try {
        _event.execute();
      } catch (Throwable t) {
        cache.getLog().warn("Async event exception", t);
      }
      final K key = _event.getKey();
      synchronized (getLockObject(key)) {
        Queue<AsyncEvent<K>> q = keyQueue.get(key);
        if (q.isEmpty()) {
          keyQueue.remove(key);
          return;
        }
        _event = q.remove();
      }
    }
  }
416552
protected function sendHelpReply(Event $event, Queue $queue, array $messages)
    {
        $method = 'irc' . $event->getCommand();
        $target = $event->getSource();
        foreach ($messages as $message) {
            $queue->$method($target, $message);
        }
    }
767919
void handleQueueMemberStatusEvent(QueueMemberStatusEvent event)
    {
        AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());

        if (queue == null)
        {
            logger.error("Ignored QueueMemberStatusEvent for unknown queue " + event.getQueue());
            return;
        }

        AsteriskQueueMemberImpl member = queue.getMemberByLocation(event.getLocation());
        if (member == null)
        {
            logger.error("Ignored QueueMemberStatusEvent for unknown member " + event.getLocation());
            return;
        }

        manageQueueMemberChange(queue, member, event);
        queue.fireMemberStateChanged(member);
    }
1084776
public function deleteReserved($queue, $id)
    {
        $this->database->transaction(function () use ($id)
        {
            $record = $this->database->table($this->table)->lockForUpdate()->find($id);

            if (! is_null($record)) {
                $this->database->table($this->table)->where('id', $id)->delete();
            }
        });
    }
1154172
protected function __completeRequest(MvcEvent $event)
    {
        $event->setTarget($this);

        $events = $this->getEventManager();
        $events->trigger(MvcEvent::EVENT_RENDER, $event);
        $events->trigger(MvcEvent::EVENT_FINISH, $event);
    }
248731
public function handleSayCommand(Event $event, Queue $queue)
    {
        $params = $event->getCustomParams();
        if (count($params) < 2) {
            $this->handleSayHelp($event, $queue);
        } else {
            $channels = array_shift($params);
            $queue->ircPrivmsg($channels, implode(' ', $params));
        }
    }
68753
protected function flushQueueItem(string $connectionName = null, MessageEnvelopeQueue $queue)
    {
        if ($queue->isEmpty()) {
            return;
        }
        $connection = $this->getConnectionHandler()->getConnection($connectionName);
        /* @var AndroidConnection $connection */
        foreach ($queue->getQueue() as $messageEnvelope) {
            /* @var AndroidMessageEnvelope $messageEnvelope */
            $this->sendMessageEnvelope($connection, $messageEnvelope);
        }
        $queue->clear();
    }
1164318
final public function dispatch(Event $event): void
    {
        if (!$event instanceof ReceivedEvent && $this->discriminator->shouldEnqueue($event)) {
            $this->queue->send($event);
        }

        if ($event instanceof ReceivedEvent) {
            $event = $event->getOriginalEvent();
        }

        $this->wrappedEventBus->dispatch($event);
    }
1224623
public void queue(final AsyncEvent<K> _event) {
    final K key = _event.getKey();
    synchronized (getLockObject(key)) {
      Queue<AsyncEvent<K>> q = keyQueue.get(key);
      if (q != null) {
        q.add(_event);
        return;
      }
      q = new LinkedList<AsyncEvent<K>>();
      keyQueue.put(key, q);
    }
    Runnable r = new Runnable() {
      @Override
      public void run() {
        runMoreOrStop(_event);
      }
    };
    executor.execute(r);
  }
18658
function(event) {
      var self = this;

      if (self._queue.length > 0) {
        var task = self._queue[0];

        // Remove this task if a matching event was passed.
        if (task.event === event) {
          self._queue.shift();
          self._loadQueue();
        }

        // Run the task if no event type is passed.
        if (!event) {
          task.action();
        }
      }

      return self;
    }
697531
public static function idle(&$queue){

        self::$_idle_event_buffer_counter ++;
        self::$_last_idle_ts = time();

        self::_buffer($queue);
    }
54848
void cleanupQueue(SubscriptionImpl subscription, Queue<Object> queue) {
        final Throwable cause = ClosedPublisherException.get();
        for (;;) {
            final Object e = queue.poll();
            if (e == null) {
                break;
            }

            try {
                if (e instanceof CloseEvent) {
                    notifySubscriberOfCloseEvent(subscription, (CloseEvent) e);
                    continue;
                }

                if (e instanceof CompletableFuture) {
                    ((CompletableFuture<?>) e).completeExceptionally(cause);
                }

                @SuppressWarnings("unchecked")
                final T obj = (T) e;
                onRemoval(obj);
            } finally {
                ReferenceCountUtil.safeRelease(e);
            }
        }
    }
831194
public function handleDnsCommand(CommandEventInterface $event, EventQueueInterface $queue)
    {
        if (get_class($event) !== '\Phergie\Irc\Plugin\React\Command\CommandEvent' &&
            get_class($event) !== 'Phergie\Irc\Plugin\React\Command\CommandEvent' &&
            !is_subclass_of($event, '\Phergie\Irc\Plugin\React\Command\CommandEvent')
        ) {
            throw new \BadMethodCallException(
                get_class($event) . ' given, expected: Phergie\Irc\Plugin\React\Command\CommandEvent'
            );
        }

        foreach ($event->getCustomParams() as $hostname) {
            $this->logDebug('Looking up: ' . $hostname);
            $this->resolveDnsQuery(
                new Query(
                    $hostname,
                    function ($ip, $hostname) use ($event, $queue) {
                        $message = $hostname . ': ' . $ip;
                        $this->logDebug($message);
                        foreach ($event->getTargets() as $target) {
                            $queue->ircPrivmsg($target, $message);
                        }
                    },
                    function ($error, $hostname) use ($event, $queue) {
                        $message = $hostname . ': error looking up hostname: ' . $error->getMessage();
                        $this->logDebug($message);
                        foreach ($event->getTargets() as $target) {
                            $queue->ircPrivmsg($target, $message);
                        }
                    }
                )
            );
        }
    }
1006167
public function subscribeQueueEvents(QueueManager $queue)
    {
        $queue->looping(function () {
            // Flush any and all events that were possibly generated by queue jobs
            Integration::flushEvents();

            // We have added a scope when a job starts processing
            Hub::getCurrent()->popScope();
        });

        foreach (static::$queueEventHandlerMap as $eventName => $handler) {
            $this->events->listen($eventName, [$this, $handler]);
        }
    }
744787
public function onAddToQueueListenerRun(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query = $event->getQuery();
        $this->database->execute($query);
    }
1025220
protected function queueRequest(UserEventInterface $event, $command, array $params)
    {
        $event->setPrefix($this->prefix);
        $event->setCommand($command);
        $event->setParams(array_filter($params, 'strlen'));
        $this->queue->insert($event, $this->getPriority($command, $params));
    }