전략편집기 화면접속 시 에러 수정

This commit is contained in:
Macbook
2026-05-31 23:36:33 +09:00
parent 2f5316d172
commit a34b49c23a
4 changed files with 96 additions and 29 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { MenuPage } from '../components/TopMenuBar';
/** 실시간 ticker REST·WS가 필요한 메뉴 (전략편집기·설정 등 제외) */
export const TICKER_FEED_PAGES: ReadonlySet<MenuPage> = new Set([
'chart',
'paper',
'virtual',
'trend-search',
'notifications',
]);
export function isTickerFeedPage(page: MenuPage): boolean {
return TICKER_FEED_PAGES.has(page);
}
+7
View File
@@ -26,6 +26,8 @@ const CACHE_TTL_MS = 12_000;
const ALL_CACHE_TTL_MS = 15_000;
const UPBIT_COOLDOWN_MS = 45_000;
const UPBIT_MIN_GAP_MS = 600;
/** 프로덕션: 브라우저→업비트 직접 호출 금지(IP 429). 개발만 폴백 허용 */
const ALLOW_UPBIT_DIRECT = import.meta.env.DEV;
function sleep(ms: number): Promise<void> {
return new Promise(r => setTimeout(r, ms));
@@ -172,6 +174,11 @@ async function fetchTickersCore(markets: string[]): Promise<UpbitTickerRaw[]> {
}
}
if (!ALLOW_UPBIT_DIRECT) {
const stale = mergeStale(want);
return stale.length > 0 ? stale : [];
}
if (Date.now() < upbitCooldownUntil) {
const stale = mergeStale(want);
if (stale.length > 0) return stale;