this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix server persistence - now runs indefinitely serving requests

- Modified server startup to be resilient to gRPC failures
- REST API now starts successfully even if gRPC server fails
- Server continues running and serving REST requests on port 3000
- Added graceful error handling for gRPC server startup issues
- REST API endpoints working correctly (health, docs, nodes, stats)

๐Ÿค– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+26 -13
kuzu_cli-linux-x86_64.tar.gz

This is a binary file and will not be displayed.

+26 -13
src/server/mod.rs
··· 53 53 54 54 /// Start both gRPC and REST servers concurrently 55 55 pub async fn start(&self) -> Result<()> { 56 - let grpc_server = GigaBrainServer::new(self.graph.clone()); 57 56 let rest_server = RestServer::new(self.graph.clone(), self.config.clone()); 58 57 59 - // Start both servers concurrently 60 - let grpc_handle = tokio::spawn(grpc_server.serve(self.config.grpc_port)); 58 + // Start REST server first 61 59 let rest_handle = tokio::spawn(rest_server.serve(self.config.rest_port)); 62 60 61 + // Try to start gRPC server, but don't fail if it can't start 62 + let grpc_handle = tokio::spawn({ 63 + let grpc_server = GigaBrainServer::new(self.graph.clone()); 64 + let port = self.config.grpc_port; 65 + async move { 66 + match grpc_server.serve(port).await { 67 + Ok(_) => println!("gRPC server completed successfully"), 68 + Err(e) => { 69 + eprintln!("โš ๏ธ gRPC server failed to start: {}", e); 70 + eprintln!(" REST API is still available"); 71 + // Keep the task alive so it doesn't exit 72 + loop { 73 + tokio::time::sleep(tokio::time::Duration::from_secs(60)).await; 74 + } 75 + } 76 + } 77 + } 78 + }); 79 + 63 80 println!( 64 - "๐Ÿš€ GigaBrain API Server started:\n ๐Ÿ“ก gRPC: localhost:{}\n ๐ŸŒ REST: http://localhost:{}", 65 - self.config.grpc_port, self.config.rest_port 81 + "๐Ÿš€ GigaBrain API Server started:\n ๐ŸŒ REST: http://localhost:{}\n ๐Ÿ“ก gRPC: localhost:{} (attempting...)", 82 + self.config.rest_port, self.config.grpc_port 66 83 ); 67 84 68 - // Wait for either server to complete (or fail) 85 + // Wait for the REST server to complete (should run indefinitely) 69 86 tokio::select! { 70 - result = grpc_handle => { 71 - match result { 72 - Ok(Ok(_)) => println!("gRPC server completed successfully"), 73 - Ok(Err(e)) => eprintln!("gRPC server error: {}", e), 74 - Err(e) => eprintln!("gRPC server join error: {}", e), 75 - } 76 - } 77 87 result = rest_handle => { 78 88 match result { 79 89 Ok(Ok(_)) => println!("REST server completed successfully"), 80 90 Ok(Err(e)) => eprintln!("REST server error: {}", e), 81 91 Err(e) => eprintln!("REST server join error: {}", e), 82 92 } 93 + } 94 + _ = grpc_handle => { 95 + // gRPC server task completed (either success or is now sleeping) 83 96 } 84 97 } 85 98