Remove as many items as possible from second_elapsed_callback() and run_scheduled_events()
We have a real system for periodic events and deferred events and so on -- several of them, in fact. We shouldn't be using second_elapsed_callback() and run_scheduled_events() to do things any more:
- Some things should be done as soon as possible, on demand (see legacy/trac#25374 (moved)).
- Some things should be done on the timers from periodic.c.
- Some things should be done with one-off timers schedueld "for later".
And some things might still need to be done once a second -- but they should be things that only need to happen when Tor is running. When Tor is idle or hibernating, or when DisableNetwork is set, we should be able to disable those once-per-second events so that we don't use so much CPU.
Please make subtickets for removing things from these functions.