aboutsummaryrefslogtreecommitdiffstats
path: root/lib/db.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/db.js')
-rw-r--r--lib/db.js12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/db.js b/lib/db.js
index acc4bff1..516db236 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -11,16 +11,9 @@ export let s = (k, v) => db.set(k, JSON.stringify(v));
let retries = {};
export let t = async (k, f) => {
- let result;
try {
- result = await db.executeIsolated(async db => {
- await db.watch(k);
- let v = await db.get(k);
- await db
- .multi()
- .set(k, await f(v))
- .exec();
- });
+ await db.watch(k);
+ await f(await db.get(k), db);
} catch (err) {
if (!err.message.includes("watch")) throw err;
@@ -37,5 +30,4 @@ export let t = async (k, f) => {
}
delete retries[k];
- return result;
};