fix: keep candle retries read-only

This commit is contained in:
2026-10-09 23:10:50 +03:00
committed by ksv741
parent db375cbee7
commit 947ffefa9b
2 changed files with 8 additions and 3 deletions
@@ -29,6 +29,7 @@ import { timestamp } from './instrument-market';
const REPLACED_WINDOW_COUNT = 1;
const NEXT_WINDOW_OFFSET = 1;
const NO_CANDLE_GAPS = 0;
type CandleInput = {
instrumentType: 'bond' | 'share';
@@ -114,7 +115,10 @@ export class CandleService {
? rangeFor(input, detail.instrument, now)
: null;
const saved = range ? await this.repository.read(input.uid, range) : null;
if (!observe && !saved) {
const hasCompleteRange = Boolean(
range && saved && candleGaps(range, saved.coverage, now).length === NO_CANDLE_GAPS,
);
if (!observe && (!saved || !hasCompleteRange)) {
await this.request(userId, revision, input, now);
}
const work = await this.repository.work(userId, revision, scope(input));