Port the pooler cleanup/maintenance logic from StormDB.