mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
fix: replace magic numbers with named constants in polling logic
Address PR review feedback: - Use WS_ACTIVITY_THRESHOLD constant instead of hardcoded 10000 in agent-info-panel.tsx - Extract AGENT_OUTPUT_POLLING_INTERVAL constant for 5000ms value in use-features.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,7 +117,7 @@ export const AgentInfoPanel = memo(function AgentInfoPanel({
|
||||
}
|
||||
// If receiving WebSocket events, use longer polling interval as fallback
|
||||
if (isReceivingWsEvents) {
|
||||
return 10000;
|
||||
return WS_ACTIVITY_THRESHOLD;
|
||||
}
|
||||
// Default polling interval
|
||||
return 3000;
|
||||
|
||||
@@ -15,6 +15,8 @@ import type { Feature } from '@/store/app-store';
|
||||
|
||||
const FEATURES_REFETCH_ON_FOCUS = false;
|
||||
const FEATURES_REFETCH_ON_RECONNECT = false;
|
||||
/** Default polling interval for agent output when WebSocket is inactive */
|
||||
const AGENT_OUTPUT_POLLING_INTERVAL = 5000;
|
||||
|
||||
/**
|
||||
* Fetch all features for a project
|
||||
@@ -136,7 +138,7 @@ export function useAgentOutput(
|
||||
}
|
||||
// Only poll if we have data and it's not empty (indicating active task)
|
||||
if (query.state.data && query.state.data.length > 0) {
|
||||
return 5000; // 5 seconds
|
||||
return AGENT_OUTPUT_POLLING_INTERVAL;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user