Merge !675: daemon: first part of refactoring

- mainly the daemon/session.* files are separated,
  moving lots of logic from daemon/worker.*;
- lib/generic/queue.* are added;
- verbose logging gets different IDs;
- various minor changes around.
28 jobs for nightly
in 10 minutes and 32 seconds and was queued for 2 seconds
Scheduled