fix: 10분 중단 즉시 복구와 대기 중 토너먼트 참가 허용
This commit is contained in:
@@ -68,8 +68,8 @@ export const turnShiftTicks = (turns: number): GameTick => {
|
||||
return asGameTick(turns * GAME_TICKS_PER_TURN);
|
||||
};
|
||||
|
||||
/** 즉시 처리 여부는 12턴 묶음 생략 전의 전체 지연으로 판정한다. */
|
||||
export const immediateRecoveryLimitSeconds = (turnSeconds: number): number => Math.min(600, turnSeconds / 10);
|
||||
/** VM/host 업데이트의 전체 중단 10분까지는 기존 엔진 순서와 budget으로 따라잡는다. */
|
||||
export const immediateRecoveryLimitSeconds = (): number => 600;
|
||||
|
||||
/**
|
||||
* observedTick은 중단 전에 저장한 관측 지점, normalTick은 기존 시간표의 현재 지점이다.
|
||||
@@ -91,8 +91,8 @@ export const planTurnRecovery = (input: {
|
||||
if (!Number.isFinite(wallNow.getTime())) throw new Error('Recovery wall instant is invalid.');
|
||||
const gap = Math.max(0, normalTick - observedTick);
|
||||
const ticksPerSecond = GAME_TICKS_PER_TURN / turnSeconds;
|
||||
const immediateLimit = immediateRecoveryLimitSeconds(turnSeconds) * ticksPerSecond;
|
||||
if (gap < immediateLimit) {
|
||||
const immediateLimit = immediateRecoveryLimitSeconds() * ticksPerSecond;
|
||||
if (gap <= immediateLimit) {
|
||||
return {
|
||||
skippedTurns: 0,
|
||||
recoveryTurns: 0,
|
||||
|
||||
@@ -160,9 +160,9 @@ describe('turn-aligned double-speed recovery', () => {
|
||||
expect(clock.executionRate(end)).toBe(1);
|
||||
});
|
||||
|
||||
it.each([300, 3600, 6000, 7200])('uses the strict whole-delay threshold for a %i second turn', (turnSeconds) => {
|
||||
it.each([60, 300, 1200, 3600, 6000, 7200])('catches up through ten minutes for a %i second turn', (turnSeconds) => {
|
||||
const rate = T / turnSeconds;
|
||||
const limitMs = Math.min(600, turnSeconds / 10) * 1000;
|
||||
const limitMs = 600_000;
|
||||
for (const delta of [-1, 0, 1]) {
|
||||
const delayMs = limitMs + delta;
|
||||
const normal = Math.trunc((delayMs * rate) / 1000);
|
||||
@@ -172,8 +172,8 @@ describe('turn-aligned double-speed recovery', () => {
|
||||
wallNow: new Date(base + delayMs),
|
||||
turnSeconds,
|
||||
});
|
||||
expect(plan.recovery === null).toBe(delta < 0);
|
||||
expect(plan.initialTick).toBe(delta < 0 ? normal : 0);
|
||||
expect(plan.recovery === null).toBe(delta <= 0);
|
||||
expect(plan.initialTick).toBe(delta <= 0 ? normal : 0);
|
||||
}
|
||||
// 장시간 중단의 작은 나머지에는 즉시 처리 예외를 다시 적용하지 않는다.
|
||||
const long = planTurnRecovery({ observedTick: 0, normalTick: 12 * T + rate, wallNow: wall(20), turnSeconds });
|
||||
|
||||
Reference in New Issue
Block a user