'Looks for unset notifications and dispatch them, in order
Never call this directly: use _process which will only allow this to
run once per pusher.'

@defer.inlineCallbacks
def _unsafe_process(self):

    fn = self.store.get_unread_push_actions_for_user_in_range_for_http
    unprocessed = (yield fn(self.user_id, self.last_stream_ordering, self.max_stream_ordering))
    for push_action in unprocessed:
        processed = (yield self._process_one(push_action))
        if processed:
            self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC
            self.last_stream_ordering = push_action['stream_ordering']
            (yield self.store.update_pusher_last_stream_ordering_and_success(self.app_id, self.pushkey, self.user_id, self.last_stream_ordering, self.clock.time_msec()))
            if self.failing_since:
                self.failing_since = None
                (yield self.store.update_pusher_failing_since(self.app_id, self.pushkey, self.user_id, self.failing_since))
        else:
            if (not self.failing_since):
                self.failing_since = self.clock.time_msec()
                (yield self.store.update_pusher_failing_since(self.app_id, self.pushkey, self.user_id, self.failing_since))
            if (self.failing_since and (self.failing_since < (self.clock.time_msec() - HttpPusher.GIVE_UP_AFTER_MS))):
                logger.warn('Giving    up    on    a    notification    to    user    %s,    pushkey    %s', self.user_id, self.pushkey)
                self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC
                self.last_stream_ordering = push_action['stream_ordering']
                (yield self.store.update_pusher_last_stream_ordering(self.app_id, self.pushkey, self.user_id, self.last_stream_ordering))
                self.failing_since = None
                (yield self.store.update_pusher_failing_since(self.app_id, self.pushkey, self.user_id, self.failing_since))
            else:
                logger.info('Push    failed:    delaying    for    %ds', self.backoff_delay)
                self.timed_call = reactor.callLater(self.backoff_delay, self.on_timer)
                self.backoff_delay = min((self.backoff_delay * 2), self.MAX_BACKOFF_SEC)
                break
