From dd52d07a513c4c98197b36eb48e213a0b2164d32 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 17 Oct 2024 11:34:53 -0700 Subject: rm payment from list --- lib/db.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/db.ts') diff --git a/lib/db.ts b/lib/db.ts index 82fa2cec..50c78e85 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -32,6 +32,8 @@ local paymentKey = KEYS[1] local balanceKey = KEYS[2] local creditKey = KEYS[3] local hashKey = KEYS[4] +local paymentsKey = KEYS[5] +local pid = KEYS[6] local total = tonumber(ARGV[1]) local credit = tonumber(ARGV[2]) @@ -43,9 +45,10 @@ if payment ~= nil then redis.call('incrby', creditKey, credit) redis.call('del', paymentKey) redis.call('del', hashKey) + redis.call('lrem', paymentsKey, 0, pid); end -return paymentKey +return pid `; let debit = defineScript({ @@ -55,7 +58,7 @@ let debit = defineScript({ }); let reverse = defineScript({ - NUMBER_OF_KEYS: 4, + NUMBER_OF_KEYS: 6, SCRIPT: REVERSE, transformArguments: (...args) => args.map((a) => a.toString()), }); -- cgit v1.2.3