fix: 모든 토너먼트 writer의 source revision을 원자화

API store뿐 아니라 월 자동 개막과 runtime clock shift도 공통 Lua writer를 사용한다. 프로필 초기화 시 revision key도 함께 제거한다.
This commit is contained in:
2026-08-16 18:49:33 +00:00
parent dd4645e4d0
commit 346f796cfc
12 changed files with 192 additions and 64 deletions
+5 -4
View File
@@ -28,11 +28,12 @@ class MemoryRedis {
}
async eval(_script: string, options: { keys: string[]; arguments: string[] }): Promise<string> {
const [valueKey, revisionKey] = options.keys;
const [value] = options.arguments;
if (!valueKey || !revisionKey || value === undefined) throw new Error('invalid eval arguments');
const revisionKey = options.keys.at(-1);
if (!revisionKey || options.keys.length !== options.arguments.length + 1) {
throw new Error('invalid eval arguments');
}
const revision = Number(this.store.get(revisionKey) ?? '0') + 1;
this.store.set(valueKey, value);
options.arguments.forEach((value, index) => this.store.set(options.keys[index]!, value));
this.store.set(revisionKey, String(revision));
return String(revision);
}