batching events
This commit is contained in:
committed by
Carl-Gerhard Lindesvärd
parent
244aa3b0d3
commit
5e225b7ae6
@@ -2,7 +2,7 @@ import { generateSalt } from '@openpanel/common';
|
||||
import { db, getCurrentSalt } from '@openpanel/db';
|
||||
|
||||
export async function salt() {
|
||||
const oldSalt = await getCurrentSalt();
|
||||
const oldSalt = await getCurrentSalt().catch(() => null);
|
||||
const newSalt = await db.salt.create({
|
||||
data: {
|
||||
salt: generateSalt(),
|
||||
@@ -13,7 +13,7 @@ export async function salt() {
|
||||
await db.salt.deleteMany({
|
||||
where: {
|
||||
salt: {
|
||||
notIn: [newSalt.salt, oldSalt],
|
||||
notIn: oldSalt ? [newSalt.salt, oldSalt] : [newSalt.salt],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user