fix: deduplicate PAUSED conversion log messages in tick pipeline (bug #337)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s
This commit is contained in:
@@ -33,6 +33,9 @@ import type { GameCoordinatorState } from './gameStore.types';
|
||||
import type { EnemyState } from '../types';
|
||||
import { applyEnemyDefenses as applyEnemyDefensesFromPipeline } from './pipelines/combat-tick';
|
||||
|
||||
// Track paused conversions already logged to avoid flooding the activity log every tick
|
||||
const loggedPausedConversions = new Set<string>();
|
||||
|
||||
export interface GameCoordinatorStore extends GameCoordinatorState {
|
||||
tick: () => void;
|
||||
resetGame: () => void;
|
||||
@@ -177,10 +180,20 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
let rawMana = ctx.mana.rawMana;
|
||||
let elements = { ...ctx.mana.elements };
|
||||
|
||||
// Log paused conversions
|
||||
// Log paused conversions (only on state change to avoid flooding the log)
|
||||
for (const [elem, entry] of Object.entries(conversionResult.rates)) {
|
||||
if (entry.paused && entry.pauseReason) {
|
||||
addLog(`⚠️ PAUSED: ${elem} conversion — ${entry.pauseReason}`);
|
||||
if (!loggedPausedConversions.has(elem)) {
|
||||
loggedPausedConversions.add(elem);
|
||||
addLog(`⚠️ PAUSED: ${elem} conversion — ${entry.pauseReason}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Clean up entries for conversions that are no longer paused
|
||||
for (const elem of loggedPausedConversions) {
|
||||
const rateEntry = conversionResult.rates[elem];
|
||||
if (!rateEntry || !rateEntry.paused) {
|
||||
loggedPausedConversions.delete(elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user