Skip to content

winery: (eventually) implement an idle timeout for rw shards

We run winery writers in active/active mode on two hosts, but only usually route requests to the host which is currently managing the primary database. When the writer fails over, shards would keep being locked in WRITING mode, even though they're idle.

Implement a RW shard idle timeout with a watchdog thread which gets pinged every time an object is added. The timeout defaults to 5 minutes, but can be adjusted with a configuration variable.

To achieve that, a few leading cleanup commits:

  • remove the database pool manager (not needed now that we only have a single database)
  • replace the clunky init/uninit patterns with (implicit) destructors or (explicit) on_shutdown hooks, and wire said hooks into gunicorn
  • and some bug fixes

Merge request reports