fix(event_history) fix a bug in event queue

Fix a bug in event_history, which might cause an error when scan through a full queue.