mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:37:07 +00:00
Add helper function to purge notifications
This commit is contained in:
@@ -1,6 +1,18 @@
|
|||||||
const { makeSubscriber, pool } = require('./connection');
|
const { makeSubscriber, pool } = require('./connection');
|
||||||
const { ALERT, ERROR, WARNING, NOTICE, INFO, DEBUG } = require('DOUGAL_ROOT/debug')(__filename);
|
const { ALERT, ERROR, WARNING, NOTICE, INFO, DEBUG } = require('DOUGAL_ROOT/debug')(__filename);
|
||||||
|
|
||||||
|
async function purge () {
|
||||||
|
DEBUG("Purging old notifications");
|
||||||
|
const client = await pool.connect();
|
||||||
|
try {
|
||||||
|
await client.query("CALL purge_notifications();");
|
||||||
|
} catch (err) {
|
||||||
|
ERROR(err);
|
||||||
|
} finally {
|
||||||
|
client.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function fullPayload (payload) {
|
async function fullPayload (payload) {
|
||||||
|
|
||||||
if (!payload.payload_id) {
|
if (!payload.payload_id) {
|
||||||
@@ -58,5 +70,6 @@ async function listen (addChannels, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
listen
|
listen,
|
||||||
|
purge
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user