From 152fe786b9d4fe059c1864d5b211ab26648e0183 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Wed, 2 Apr 2025 07:42:52 +0100 Subject: [PATCH] chore: deprecate old unused tables --- lib/plugins.js | 8 -------- lib/poller.js | 4 ---- migrations/1743526540370-deprecate-tables.js | 12 ++++++++++++ 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 migrations/1743526540370-deprecate-tables.js diff --git a/lib/plugins.js b/lib/plugins.js index 9c9d1a29..3bdf0181 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -456,13 +456,6 @@ function plugins (settings, deviceId) { .catch(logger.error) } - function pong () { - return db.none(`UPDATE server_events SET created=now() WHERE event_type=$1; - INSERT INTO server_events (event_type) SELECT $1 - WHERE NOT EXISTS (SELECT 1 FROM server_events WHERE event_type=$1);`, ['ping']) - .catch(logger.error) - } - /* * Trader functions */ @@ -935,7 +928,6 @@ function plugins (settings, deviceId) { getPhoneCode, getEmailCode, executeTrades, - pong, clearOldLogs, notifyConfirmation, sweepHd, diff --git a/lib/poller.js b/lib/poller.js index 9539c6f1..e657bb1e 100644 --- a/lib/poller.js +++ b/lib/poller.js @@ -15,7 +15,6 @@ const configManager = require('./new-config-manager') const complianceTriggers = require('./compliance-triggers') const settingsLoader = require('./new-settings-loader') const NodeCache = require('node-cache') -const util = require('util') const db = require('./db') const processBatches = require('./tx-batching-processing') @@ -24,7 +23,6 @@ const LIVE_INCOMING_TX_INTERVAL = 5 * T.seconds const UNNOTIFIED_INTERVAL = 10 * T.seconds const SWEEP_HD_INTERVAL = 5 * T.minute const TRADE_INTERVAL = 60 * T.seconds -const PONG_INTERVAL = 10 * T.seconds const LOGS_CLEAR_INTERVAL = 1 * T.day const SANCTIONS_INITIAL_DOWNLOAD_INTERVAL = 5 * T.minutes const SANCTIONS_UPDATE_INTERVAL = 1 * T.day @@ -224,7 +222,6 @@ function addToQueue (func, interval, queue, ...vars) { function doPolling () { pi().executeTrades() - pi().pong() pi().clearOldLogs() cashOutTx.monitorLiveIncoming(settings()) cashOutTx.monitorStaleIncoming(settings()) @@ -241,7 +238,6 @@ function doPolling () { addToQueue(cashInTx.monitorPending, PENDING_INTERVAL, QUEUE.FAST, settings) addToQueue(processBatches, UNNOTIFIED_INTERVAL, QUEUE.FAST, settings, TRANSACTION_BATCH_LIFECYCLE) addToQueue(pi().sweepHd, SWEEP_HD_INTERVAL, QUEUE.FAST, settings) - addToQueue(pi().pong, PONG_INTERVAL, QUEUE.FAST) addToQueue(pi().clearOldLogs, LOGS_CLEAR_INTERVAL, QUEUE.SLOW) addToQueue(notifier.checkNotification, CHECK_NOTIFICATION_INTERVAL, QUEUE.FAST, pi) addToQueue(initialSanctionsDownload, SANCTIONS_INITIAL_DOWNLOAD_INTERVAL, QUEUE.SLOW) diff --git a/migrations/1743526540370-deprecate-tables.js b/migrations/1743526540370-deprecate-tables.js new file mode 100644 index 00000000..c478442f --- /dev/null +++ b/migrations/1743526540370-deprecate-tables.js @@ -0,0 +1,12 @@ +const db = require('./db') + +exports.up = next => db.multi([ + 'DROP TABLE aggregated_machine_pings;', + 'DROP TABLE cash_in_refills;', + 'DROP TABLE cash_out_refills;', + 'DROP TABLE customer_compliance_persistence;', + 'DROP TABLE compliance_overrides_persistence;', + 'DROP TABLE server_events;', +], next) + +exports.down = next => next()