From 1365f1f88e6a675d1109d2f18db9f69df01fbc5c Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Wed, 10 Jul 2024 13:12:28 -0700 Subject: [PATCH] fix(shuttle): Fix resetting of batch flush logic when exceeding byte limit (#2151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why is this change needed? This results in the batch being flushed after each event since we don't reset the count on flush. ## Merge Checklist - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [ ] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. --- ## PR-Codex overview This PR updates the version to 0.5.1, fixing a bug related to the reset of the total batch bytes limit in `shuttle`. ### Detailed summary - Updated version to 0.5.1 - Fixed reset of limit for total batch bytes in `hubSubscriber.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- packages/shuttle/CHANGELOG.md | 6 ++++++ packages/shuttle/package.json | 2 +- packages/shuttle/src/shuttle/hubSubscriber.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/shuttle/CHANGELOG.md b/packages/shuttle/CHANGELOG.md index bf91d5f199..019239cf87 100644 --- a/packages/shuttle/CHANGELOG.md +++ b/packages/shuttle/CHANGELOG.md @@ -1,5 +1,11 @@ # @farcaster/hub-shuttle +## 0.5.1 + +### Patch Changes + +- Fix reset of limit for total batch bytes + ## 0.5.0 ### Minor Changes diff --git a/packages/shuttle/package.json b/packages/shuttle/package.json index 2e5e04158f..c7f1801cf8 100644 --- a/packages/shuttle/package.json +++ b/packages/shuttle/package.json @@ -1,6 +1,6 @@ { "name": "@farcaster/shuttle", - "version": "0.5.0", + "version": "0.5.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/shuttle/src/shuttle/hubSubscriber.ts b/packages/shuttle/src/shuttle/hubSubscriber.ts index b596d3fdcf..bf42c65fb6 100644 --- a/packages/shuttle/src/shuttle/hubSubscriber.ts +++ b/packages/shuttle/src/shuttle/hubSubscriber.ts @@ -222,6 +222,7 @@ export class EventStreamHubSubscriber extends BaseHubSubscriber { ) { // Empties the current batch const eventBatch = this.eventsToAdd.splice(0, this.eventsToAdd.length); + this.eventBatchBytes = 0; // Copies the removed events to the stream await this.eventStream.add(