Doing it on the queue monitor thread was problematic because processing the queue can take a while.
XV4AEKJCFTNCOR52IRFYHORCNNFKIHOADIUARTC2U5Z6ZQBEEFYQC RQUAATWBGEP3YT4F555XLJYRRRGHDTEILHFORES7AM2XAOVMVJSAC CCHPYTCPXUHLSQWDBDVZNFTUSMRLW45DKYTVCU3XKYE3OU5RPUEQC 24BMQDZAWDQ7VNIA7TIROXSOYLOJBNZ2E4264WHWNJAEN6ZB3UOAC ATJ54SPXPE2IIFRERUOBFF42HBSEADP4QOI743ZBUNBQX3PYKRXQC C6HOMHZWMSC7ORGFUF5YG2ACKV2SCP26HL3UH6VXH6RNDYRXH5DAC T2EIYJNGPIANHKJ4HBJIPTINWKG7RDLHR3PVHFYAPPLHZAJQBVWAC NJJ7H64SZOX5EGACDCQAUQ7R6UEWD5IIC35A2MWFOOJV55DJYPHAC }};struct receiver : public pqxx::notification_receiver{bool status = false;receiver(pqxx::connection_base & c, const std::string & channel): pqxx::notification_receiver(c, channel) { }void operator() (const string & payload, int pid) override{status = true;};bool get() {bool b = status;status = false;return b;
struct receiver : public pqxx::notification_receiver{bool status = false;receiver(pqxx::connection_base & c, const std::string & channel): pqxx::notification_receiver(c, channel) { }void operator() (const string & payload, int pid) override{status = true;};bool get() {bool b = status;status = false;return b;}};
while (true) {try {auto conn(dbPool.get());receiver dumpStatus(*conn, "dump_status");while (true) {conn->await_notification();if (dumpStatus.get())State::dumpStatus();}} catch (std::exception & e) {printMsg(lvlError, format("main thread: %1%") % e.what());sleep(10); // probably a DB problem, so don't retry right away}}