3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 04:25:01 +00:00

Enforce unified lock names by using functions to generate lock keys (#165)

This commit is contained in:
Nils 2021-04-02 15:43:13 +02:00 committed by GitHub
parent fcbb25b7ff
commit c5d68650a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 70 additions and 28 deletions

View file

@ -1,4 +1,5 @@
import { GuildPluginData } from "knub";
import { counterIdLock } from "../../../utils/lockNameHelpers";
import { CountersPluginType } from "../types";
import { checkCounterTrigger } from "./checkCounterTrigger";
import { checkReverseCounterTrigger } from "./checkReverseCounterTrigger";
@ -25,7 +26,7 @@ export async function setCounterValue(
}
const counterId = pluginData.state.counterIds[counterName];
const lock = await pluginData.locks.acquire(counterId.toString());
const lock = await pluginData.locks.acquire(counterIdLock(counterId));
await pluginData.state.counters.setCounterValue(counterId, channelId, userId, value);