-
-
Notifications
You must be signed in to change notification settings - Fork 63
stream() computes default pageSize before ready(), which can break live streaming #173
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi, I found a live-streaming issue in PineTS 0.9.7.
stream() computes the default pageSize before await this.ready():
const pageSize = options.pageSize || this.data.length;
At that point this.data.length can still be 0, so pageSize becomes 0 and is never recomputed later.
This can break _runPaginated() / live streaming behavior:
ctx.idxmay stay at0ctx.marketData[ctx.idx]may point to an old historical candle instead of the latest candle- the historical/live branch in
stream()can misclassify the current candle - in practice this caused repeated processing of the same candle, no bar progression, and in some runs a hot loop with very high CPU usage
Relevant code:
src/PineTS.class.ts:stream()src/PineTS.class.ts:_runPaginated()
Suggested fix:
- compute the fallback
pageSizeafterawait this.ready(), or - lazily resolve the default from the loaded data before calling
_runPaginated()
Workaround on the consumer side:
- pass an explicit
pageSizetostream()
I can provide a minimal repro if helpful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working