Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shuttle): Parametrize hub connection timeouts for HubSubscriber & MessageReconciliation #2367

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

tybook
Copy link
Contributor

@tybook tybook commented Oct 15, 2024

Why is this change needed?

Running the latest version of Shuttle with its fixed 5000ms hub connection timeout for reconciliation has resulted in a lot of timeout failures even against a seemingly healthy hub. I've increased the default connection timeout of MessageReconciliation from 5000ms to 30000ms to match HubSubscriber's and parameterized both.

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review


PR-Codex overview

This PR introduces parameterized connection timeouts for the HubSubscriber and MessageReconciliation classes, allowing for more flexible timeout settings in handling unresponsive connections.

Detailed summary

  • Added connectionTimeout parameter to the constructors of MessageReconciliation and BaseHubSubscriber, defaulting to 30000 milliseconds.
  • Updated timeout handling in MessageReconciliation to use connectionTimeout.
  • Adjusted timeout in tests to account for new configurable timeout settings.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Oct 15, 2024

🦋 Changeset detected

Latest commit: 7d66f04

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@farcaster/shuttle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2024 7:27pm

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 34.96%. Comparing base (1880070) to head (7d66f04).
Report is 402 commits behind head on main.

Files with missing lines Patch % Lines
packages/shuttle/src/shuttle/hubSubscriber.ts 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (1880070) and HEAD (7d66f04). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (1880070) HEAD (7d66f04)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2367       +/-   ##
===========================================
- Coverage   74.05%   34.96%   -39.10%     
===========================================
  Files          99      146       +47     
  Lines        9425    26201    +16776     
  Branches     2097     9297     +7200     
===========================================
+ Hits         6980     9162     +2182     
- Misses       2327    14675    +12348     
- Partials      118     2364     +2246     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -767,7 +767,7 @@ describe("shuttle", () => {
};

// Only include 2 of the 3 messages in the time window
const reconciler = new MessageReconciliation(mockRPCClient as unknown as HubRpcClient, db, log);
const reconciler = new MessageReconciliation(mockRPCClient as unknown as HubRpcClient, db, log, 500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a few ms shorter (or the timeout above longer) so we don't have flaky tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@sanjayprabhu sanjayprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@sanjayprabhu sanjayprabhu merged commit 727041c into farcasterxyz:main Oct 16, 2024
7 of 9 checks passed
tybook added a commit to tybook/hub-monorepo that referenced this pull request Oct 25, 2024
…riber

Follow-up to farcasterxyz#2367. Missed piping through BaseHubSubscriber's new `connectionTimeout` param through to EventStreamHubSubscriber.
tybook added a commit to tybook/hub-monorepo that referenced this pull request Oct 25, 2024
…riber

    Follow-up to farcasterxyz#2367. Missed piping through BaseHubSubscribers new `connectionTimeout` param through to EventStreamHubSubscriber.
sanjayprabhu pushed a commit that referenced this pull request Oct 28, 2024
…riber (#2382)

## Why is this change needed?

Follow-up to #2367. I
missed piping through BaseHubSubscriber's new `connectionTimeout` param
through to EventStreamHubSubscriber, which means `connectionTimeout`
isn't really configurable for streaming right now like it should be.

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [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)
- [x] 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 focuses on adding a new optional parameter, `connectionTimeout`,
to the `EventStreamHubSubscriber` class, allowing for better control
over connection timeouts.

### Detailed summary
- Added `connectionTimeout?: number` as an optional parameter in the
constructor of `EventStreamHubSubscriber`.
- Updated the call to `super` in the constructor to include the new
`connectionTimeout` argument.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants