mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Enforce unified lock names by using functions to generate lock keys (#165)
This commit is contained in:
parent
fcbb25b7ff
commit
c5d68650a3
18 changed files with 70 additions and 28 deletions
|
@ -2,6 +2,7 @@ import { GuildPluginData } from "knub";
|
|||
import { CountersPluginType } from "../types";
|
||||
import { checkAllValuesForTrigger } from "./checkAllValuesForTrigger";
|
||||
import { checkAllValuesForReverseTrigger } from "./checkAllValuesForReverseTrigger";
|
||||
import { counterIdLock } from "../../../utils/lockNameHelpers";
|
||||
|
||||
export async function decayCounter(
|
||||
pluginData: GuildPluginData<CountersPluginType>,
|
||||
|
@ -16,7 +17,7 @@ export async function decayCounter(
|
|||
}
|
||||
|
||||
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.decay(counterId, decayPeriodMS, decayAmount);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue