refactor(server): embrace Falcon fiber reactor, strip thread mutexes, and modernize caching - #1141
Merged
Merged
Conversation
… and modernize caching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Rack::Timeoutto Falcon + Async fiber reactor.Async::TimeoutErrorto504 GATEWAY_TIMEOUTwith standardizedRetry-After: 300headers.Concurrent::IVar,Concurrent::Map,Mutex,try_lock, spin loops).Feeds::Cachewith fiber-nativeInFlightwaiter (Async::Notification) andData.define(:result, :expires_at). Safely propagatesAsync::Stopcancellation to pending waiters.RateLimiterwith lock-free fiber-safe hash tracking and automated window pruning.AccountManagersnapshot memoization andRequestContextusingFiber[:request_context].Feeds::Rendererand eliminate redundantFeeds::HttpCachewrapper.async_feed_refresh_enabledandasync_feed_refresh_stale_factor.strategy: 'default'(while preserving legacyfaradaytoken decode and execution backward compatibility).html2rssdependency to released~> 0.30(0.30.0).Why
Switching to Falcon eliminates thread contention and unlocks fiber concurrency across asynchronous HTTP and caching pipelines. Stripping obsolete thread synchronization primitives (
Mutex,concurrent-ruby) significantly reduces code complexity, allocation overhead, and legacy surface area while ensuring clean fiber cancellation semantics. Completes the Faraday -> HTTPX and Puma -> Falcon cutover with the publishedhtml2rssv0.30.0 release.Risk
Review map
app/web/feeds/cache.rb— Fiber-native cache withAsync::Notificationin-flight deduplication.app/web/request/rate_limiter.rb— Lock-free rate limiting with automatic pruning.app/web/errors/error_classifier.rb—Async::TimeoutErrorclassification and HTTPX error notes.app/web/config/runtime_env.rb&app/web/config/flags.rb— Runtime config and flag cleanup.app/web/feeds/renderer.rb— Inlined cache headers.spec/html2rss/web/feeds/source_resolver_spec.rb— Legacyfaradaytoken backward compatibility spec.spec/html2rss/web/feeds/cache_spec.rb— Concurrency and fiber cancellation specs.Gemfile&Gemfile.lock— Bumphtml2rssto released0.30.0.Validation
make ready(357 examples, 0 failures; RuboCop clean; Zeitwerk clean; YARD public docs clean; TypeScript clean; ESLint clean; Prettier clean).make openapi-verifypassed.make ci-readypassed (Playwright frontend e2e smoke, OpenAPI verify, linting, formatting, full test suite).