def _process_event_queue(self):
    """File event notification queue processor. """
    try:
      event = self._event_queue.get(timeout=0.05)
    except queue.Empty:
      return

    try:
      subscription, is_initial_event, files = (event['subscription'],
                                               event['is_fresh_instance'],
                                               event['files'] if PY3 else [f.decode('utf-8') for f in event['files']])
    except (KeyError, UnicodeDecodeError) as e:
      self._logger.warn('%r raised by invalid watchman event: %s', e, event)
      return

    self._logger.debug('processing {} files for subscription {} (first_event={})'
                       .format(len(files), subscription, is_initial_event))

    # The first watchman event is a listing of all files - ignore it.
    if not is_initial_event:
      if subscription == self._fs_event_service.PANTS_PID_SUBSCRIPTION_NAME:
        self._maybe_invalidate_scheduler_pidfile()
      else:
        self._handle_batch_event(files)

    if not self._watchman_is_running.is_set():
      self._watchman_is_running.set()

    self._event_queue.task_done()
File event notification queue processor.