Fix debug code.
Reduce duplicates.
Add a tooltip for the "Drop pending events" option.
Make drop_pending_events a virtual attribe of Agent.
Do not update last_checked_event_id if an agent cannot receive events.

Use `maximum` while at it.