Move server code into Restate::Server module to avoid loading async eagerly#9
Merged
Merged
Conversation
…agerly `require "restate"` previously loaded server_context.rb which pulls in the async gem unconditionally. This conflicts with host apps like Rails that don't need the server runtime. Move the Rack app and execution context into lib/restate/server/: - Restate::Server (class) -> Restate::Server::Handler - Restate::ServerContext -> Restate::Server::Context The server module loads lazily via Endpoint#app or explicitly via `require "restate/server"`. Core SDK loads remain async-free. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Restate::Server(Rack app) andRestate::ServerContext(execution context) into aRestate::Servermodule namespace underlib/restate/server/require "restate"no longer loads theasyncgem, preventing conflicts with host apps like RailsEndpoint#appor explicitly viarequire "restate/server"Class Renames
Restate::Server(class)Restate::Server::HandlerRestate::ServerContextRestate::Server::ContextLoading Options
require "restate"-- core only, no async (safe for Rails)require "restate/server"-- core + server (loads async), for apps that need the server at bootEndpoint#app-- lazy-loads server on demand (existing behavior, just deferred)Test plan
require "restate"does NOT loadAsyncrequire "restate/server"loadsAsync+Server::Handler+Server::ContextEndpoint#applazy-loads correctly (no async before, async after)Made with Cursor