Update index.js

This commit is contained in:
Nikita 2024-12-11 18:01:44 +03:00
parent df2d7c3759
commit cf1d2c7c65

View file

@ -98,7 +98,7 @@ export default class BlocksStreamProcessor {
async tryParseWithDelay(jsonContent) { async tryParseWithDelay(jsonContent) {
const now = Date.now(); const now = Date.now();
if (now - this.lastUpdate >= this.RENDER_DELAY) { if (now - this.lastUpdate >= this.renderDelay) {
await this.tryParseIncomplete(jsonContent); await this.tryParseIncomplete(jsonContent);
} }
} }
@ -343,11 +343,11 @@ export default class BlocksStreamProcessor {
// Apply render delay only in batch mode or if it's too soon // Apply render delay only in batch mode or if it's too soon
if ( if (
(this.isBatchMode || timeSinceLastUpdate < this.RENDER_DELAY) && (this.isBatchMode || timeSinceLastUpdate < this.renderDelay) &&
!isFinal !isFinal
) { ) {
await new Promise((resolve) => await new Promise((resolve) =>
setTimeout(resolve, this.RENDER_DELAY - timeSinceLastUpdate) setTimeout(resolve, this.renderDelay - timeSinceLastUpdate)
); );
} }