'Called to queue sending an event with the next batch of events.
Sending events individually, as they occur, has been problematic as it
can result in a flood of sends.  Previously, there was a loopingcall
thread that would send batched events on a periodic interval.  However,
maintaining a persistent thread in the loopingcall was also
problematic.
This replaces the loopingcall with a mechanism that creates a
short-lived thread on demand whenever an event is queued. That thread
will wait for a lock, send all queued events and then sleep for
\'batch_interval\' seconds to allow other events to queue up.
This effectively acts as a rate limiter to only allow 1 batch per
\'batch_interval\' seconds.
:param event: the event that occurred.'

def queue_event(self, event):

    if (not event):
        return
    self.pending_events.append(event)
    @utils.synchronized(self._lock_identifier)
    def synced_send():
        self._notify()
        eventlet.sleep(self.batch_interval)
    eventlet.spawn_n(synced_send)
