fix: enqueue sweeping requests and loosen sweep polling

This commit is contained in:
Sérgio Salgado 2022-07-05 21:22:00 +01:00
parent ecdc020113
commit fa0ef6b053
3 changed files with 12 additions and 4 deletions

View file

@ -806,8 +806,8 @@ function plugins (settings, deviceId) {
}
function sweepHd () {
const sql = `select id, crypto_code, hd_index from cash_out_txs
where hd_index is not null and not swept and status in ('confirmed', 'instant')`
const sql = `SELECT id, crypto_code, hd_index FROM cash_out_txs
WHERE hd_index IS NOT NULL AND NOT swept AND status IN ('confirmed', 'instant') AND created < now() - interval '1 week'`
return db.any(sql)
.then(rows => Promise.all(rows.map(sweepHdRow)))