Skip to content

feat(nip-01): send rate-limited backoff hint on CLOSED - #821

Merged
cameri merged 2 commits into
mainfrom
feat/closed-rate-limited-hint
Oct 13, 2026
Merged

cameri merged 2 commits into
mainfrom
feat/closed-rate-limited-hint

Conversation

@Ferryx349

Copy link
Copy Markdown
Collaborator

Description

This PR completes the CLOSED half of nostr-protocol/nips#2498 (#807 did OK).

Implements option 1 from the issue.

Related Issue

Closes #820

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d3f047e

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

This PR includes changesets to release 1 package
Name Type
nostream Minor

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

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

This PR adds an optional backoff value to CLOSED responses.

  • Rate-limited reads get a CLOSED reply with a backoff hint.
  • CLOSED replies can include an optional fourth string.

The previous unnumbered thread was manually resolved by Ferryx349 without an explanatory reply. No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Incoming message] --> B{Rate limited?}
  B -->|No| C[Validate and run handler]
  B -->|Yes| D{Message type}
  D -->|REQ| E[Abort matching reads and remove subscription]
  E --> F[Send CLOSED with backoff]
  D -->|COUNT| F
  D -->|Other or invalid JSON| G[Send NOTICE]
Loading

Reviews (2) · Last reviewed commit: "fix(nip-01): tear down subscription befo..." · Reviewed by Greptile

Comment thread src/adapters/web-socket-adapter.ts
@coveralls

coveralls commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 73.973% (+0.06%) from 73.911% — feat/closed-rate-limited-hint into main

Abort in-flight REQ reads and remove the active subscription when the
per-IP message limit closes a subscription, so clients do not keep
receiving EVENT/EOSE after CLOSED.
@cameri
cameri merged commit 36d2a30 into main Oct 13, 2026
16 of 17 checks passed
@cameri
cameri deleted the feat/closed-rate-limited-hint branch October 13, 2026 19:13
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.

feat(nip-01): send the rate-limited backoff hint on CLOSED (the half of nostr-protocol/nips#2498 the relay does not send)

3 participants