fix: 모든 토너먼트 writer의 source revision을 원자화
API store뿐 아니라 월 자동 개막과 runtime clock shift도 공통 Lua writer를 사용한다. 프로필 초기화 시 revision key도 함께 제거한다.
This commit is contained in:
@@ -244,6 +244,13 @@ describe('runtime clock shift projection', () => {
|
||||
},
|
||||
del: async (key: string) => (values.delete(key) ? 1 : 0),
|
||||
zAdd,
|
||||
eval: async (_script: string, options: { keys: string[]; arguments: string[] }) => {
|
||||
const revisionKey = options.keys.at(-1)!;
|
||||
options.arguments.forEach((value, index) => values.set(options.keys[index]!, value));
|
||||
const revision = Number(values.get(revisionKey) ?? '0') + 1;
|
||||
values.set(revisionKey, String(revision));
|
||||
return String(revision);
|
||||
},
|
||||
};
|
||||
const action = {
|
||||
id: actionId,
|
||||
|
||||
@@ -57,6 +57,13 @@ describe('monthly tournament auto start', () => {
|
||||
values.set(key, value);
|
||||
return 'OK';
|
||||
},
|
||||
eval: async (_script: string, options: { keys: string[]; arguments: string[] }) => {
|
||||
const revisionKey = options.keys.at(-1)!;
|
||||
options.arguments.forEach((value, index) => values.set(options.keys[index]!, value));
|
||||
const revision = Number(values.get(revisionKey) ?? '0') + 1;
|
||||
values.set(revisionKey, String(revision));
|
||||
return String(revision);
|
||||
},
|
||||
} as unknown as RedisConnector['client'];
|
||||
let world: InMemoryTurnWorld | null = null;
|
||||
const consumed: boolean[] = [];
|
||||
@@ -186,6 +193,13 @@ describe('monthly tournament auto start', () => {
|
||||
values.set(key, value);
|
||||
return 'OK';
|
||||
},
|
||||
eval: async (_script: string, options: { keys: string[]; arguments: string[] }) => {
|
||||
const revisionKey = options.keys.at(-1)!;
|
||||
options.arguments.forEach((value, index) => values.set(options.keys[index]!, value));
|
||||
const revision = Number(values.get(revisionKey) ?? '0') + 1;
|
||||
values.set(revisionKey, String(revision));
|
||||
return String(revision);
|
||||
},
|
||||
} as unknown as RedisConnector['client'];
|
||||
let world: InMemoryTurnWorld | null = null;
|
||||
world = new InMemoryTurnWorld(state, snapshot, {
|
||||
|
||||
Reference in New Issue
Block a user