Skip to content

Invalidate socket tokens on close#2

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
socket-token-close-invalidates
May 22, 2026
Merged

Invalidate socket tokens on close#2
samuel-williams-shopify merged 1 commit into
mainfrom
socket-token-close-invalidates

Conversation

@samuel-williams-shopify
Copy link
Copy Markdown
Contributor

@samuel-williams-shopify samuel-williams-shopify commented May 22, 2026

What?

This PR updates Falcon::Limiter::Socket#close to call Async::Limiter::Token#close instead of release, and bumps the dependency to async-limiter ~> 2.3.

The socket still exposes the original async-limiter token, so the long-task release/re-acquire path continues to work while the socket is open. Once the socket closes, the token is released and invalidated by async-limiter so cached references cannot re-acquire a permit.

Why?

Storefront can cache socket.token for long-task coordination. With plain release, a cached token could later re-acquire accept capacity after the owning socket had already closed, leaving no future socket-close event to release that permit. Repeated disconnects during started long tasks could leak accept permits.

Verification

Verified against released async-limiter 2.3.0 with:

  • PATH=/Users/samuel/.rubies/ruby-3.4.4/bin:$PATH BUNDLE_GEMFILE=gems.rb COVERAGE=PartialSummary bundle exec sus
  • PATH=/Users/samuel/.rubies/ruby-3.4.4/bin:$PATH BUNDLE_GEMFILE=gems.rb bundle exec bake covered:validate --paths .covered.db \;
  • PATH=/Users/samuel/.rubies/ruby-3.4.4/bin:$PATH BUNDLE_GEMFILE=gems.rb bundle exec rubocop
  • PATH=/Users/samuel/.rubies/ruby-3.4.4/bin:$PATH BUNDLE_GEMFILE=gems.rb bundle exec bake decode:index:coverage lib

@samuel-williams-shopify samuel-williams-shopify force-pushed the socket-token-close-invalidates branch 2 times, most recently from 03255fc to d78a2b9 Compare May 22, 2026 10:19
@samuel-williams-shopify samuel-williams-shopify force-pushed the socket-token-close-invalidates branch from d78a2b9 to 57b10b9 Compare May 22, 2026 10:25
@samuel-williams-shopify samuel-williams-shopify merged commit 1cbcf1a into main May 22, 2026
36 of 40 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the socket-token-close-invalidates branch May 22, 2026 10:28
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.

1 participant