Wait for beanstalkd connection on startup.
Fixes for the new analytics logging implementation:

- Create beanstalkd's directory on startup.
- Adjust log job rescheduling logic to simplify the implementation.
- Log the analytics data, even if it's not complete after a few retries
  if we have most of the data.
- Fix logging of cached responses.
- Wipe beanstalkd's data between tests, so leftover data doesn't
  interfere with new test runs.