Remove configuration reload action in cardano-rpc server startup#1114
Remove configuration reload action in cardano-rpc server startup#1114carbolymer wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Removes the configuration reload action from cardano-rpc server startup, switching runRpcServer to accept a preloaded (RpcConfig, NetworkMagic) since reload is now handled via full server restart.
Changes:
- Update
runRpcServersignature to take(RpcConfig, NetworkMagic)instead of anIOreload action. - Inline destructuring of the configuration tuple in
runRpcServer. - Remove outdated TODO/comment about logging on config reload.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runRpcServer | ||
| :: Tracer IO TraceRpc | ||
| -> IO (RpcConfig, NetworkMagic) | ||
| -- ^ action which reloads RPC configuration | ||
| -> (RpcConfig, NetworkMagic) | ||
| -> IO () | ||
| runRpcServer tracer loadRpcConfig = handleFatalExceptions $ do | ||
| ( rpcConfig@RpcConfig | ||
| { isEnabled = Identity isEnabled | ||
| , rpcSocketPath = Identity (File rpcSocketPathFp) | ||
| , nodeSocketPath = Identity nodeSocketPath | ||
| } | ||
| , networkMagic | ||
| ) <- | ||
| loadRpcConfig | ||
| let config = | ||
| runRpcServer tracer rpcConfig = handleFatalExceptions $ do |
There was a problem hiding this comment.
This changes runRpcServer from taking an IO action to taking a pure (RpcConfig, NetworkMagic) value, which is an API-breaking change for any existing call sites. If the project expects this function to remain stable for external/internal consumers, consider keeping a backward-compatible wrapper (e.g., runRpcServerWithReload :: Tracer IO TraceRpc -> IO (RpcConfig, NetworkMagic) -> IO ()) that calls the new runRpcServer after loading once.
| runRpcServer tracer rpcConfig = handleFatalExceptions $ do | ||
| let ( RpcConfig | ||
| { isEnabled = Identity isEnabled | ||
| , rpcSocketPath = Identity (File rpcSocketPathFp) | ||
| , nodeSocketPath = Identity nodeSocketPath | ||
| } | ||
| , networkMagic | ||
| ) = rpcConfig | ||
| config = |
There was a problem hiding this comment.
The parameter name rpcConfig is misleading now that it holds a tuple (RpcConfig, NetworkMagic) (it’s not just the RpcConfig). Renaming it to something like rpcCfgAndMagic / rpcConfigAndMagic (or destructuring in the argument list) would make the code easier to read and reduce confusion.
Changelog
Context
This is not needed anymore, as configuration reload is implemented as whole server restart:
Checklist