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.idx may stay at 0
ctx.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
pageSize after await this.ready(), or
- lazily resolve the default from the loaded data before calling
_runPaginated()
Workaround on the consumer side:
- pass an explicit
pageSize to stream()
I can provide a minimal repro if helpful.
Hi, I found a live-streaming issue in PineTS 0.9.7.
stream()computes the defaultpageSizebeforeawait this.ready():const pageSize = options.pageSize || this.data.length;At that point
this.data.lengthcan still be0, sopageSizebecomes0and 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 candlestream()can misclassify the current candleRelevant code:
src/PineTS.class.ts:stream()src/PineTS.class.ts:_runPaginated()Suggested fix:
pageSizeafterawait this.ready(), or_runPaginated()Workaround on the consumer side:
pageSizetostream()I can provide a minimal repro if helpful.