Revert "hotfix: use multi-threaded runtime" #544
                
     Merged
            
            
          
  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.
  
    
  
    
Reverts #539
Greptile Summary
Updated On: 2025-09-12 20:53:50 UTC
This PR reverts a previous hotfix (#539) that attempted to use a multi-threaded runtime for the JSON-RPC service. The revert restores the original implementation that creates a dedicated multi-threaded Tokio runtime for handling JSON-RPC requests.
The key changes include:
Added dedicated runtime management: The
JsonRpcServicestruct now contains aruntime: Arc<Runtime>field that holds an owned runtime instance instead of relying on the ambient runtime context.Introduced
get_runtime()function: This new function creates a purpose-built multi-threaded runtime with configurable worker threads, custom thread naming ("solRpcEl"), and thread niceness adjustment for optimal performance. It ensures at least one thread is allocated and applies priority adjustments to prevent blocking operations.Changed runtime usage pattern: The HTTP server now uses the service's own runtime handle (
.event_loop_executor(runtime)) instead of relying onruntime::Handle::current()from the calling context.This revert addresses issues where the previous hotfix failed in environments lacking an ambient runtime or where the calling context's runtime wasn't suitable for RPC operations. The dedicated runtime approach provides explicit control over execution context, thread configuration, and performance characteristics, following Solana's implementation pattern to avoid blocking the socket-listening event loop and prevent client timeouts.
Confidence score: 4/5
get_runtime()function implementation and runtime handle usage patterns