in src/ResultReadable.ts [103:152]
private async _pushPageValues(): Promise<void> {
let canPush: boolean = true;
try {
if (this._shouldPushCachedPage) {
this._shouldPushCachedPage = false;
} else if (this._cachedPage.NextPageToken) {
try {
const fetchPageResult: FetchPageResult =
await this._communicator.fetchPage(this._txnId, this._cachedPage.NextPageToken);
this._cachedPage = fetchPageResult.Page;
if (fetchPageResult.ConsumedIOs != null) {
this._readIOs += fetchPageResult.ConsumedIOs.ReadIOs;
}
if (fetchPageResult.TimingInformation != null) {
this._processingTime += fetchPageResult.TimingInformation.ProcessingTimeMilliseconds;
}
this._retrieveIndex = 0;
} catch (e) {
this.destroy(e);
canPush = false;
return;
}
}
while (this._retrieveIndex < this._cachedPage.Values.length) {
const ionValue: dom.Value =
dom.load(Result._handleBlob(this._cachedPage.Values[this._retrieveIndex++].IonBinary));
canPush = this.push(ionValue);
if (!canPush) {
this._shouldPushCachedPage = this._retrieveIndex < this._cachedPage.Values.length;
return;
}
}
if (!this._cachedPage.NextPageToken) {
this.push(null);
canPush = false;
}
} finally {
this._isPushingData = false;
if (canPush) {
this._read();
}
}
}