Skip to content

Commit

Permalink
fix(shuttle): Fix resetting of batch flush logic when exceeding byte …
Browse files Browse the repository at this point in the history
…limit (farcasterxyz#2151)

## 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.


<!-- start pr-codex -->

---

## 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}`

<!-- end pr-codex -->
  • Loading branch information
sds authored Jul 10, 2024
1 parent b1dc30a commit 1365f1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/shuttle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/shuttle/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/shuttle/src/shuttle/hubSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 1365f1f

Please sign in to comment.