File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ use crate::{
66use code0_flow:: flow_definition:: FlowUpdateService ;
77use std:: sync:: Arc ;
88use tokio:: sync:: broadcast;
9+ use tonic:: transport:: Server ;
10+ use tonic_health:: pb:: health_server:: HealthServer ;
911
1012/*
1113 * The ServerRunner is intended to be used as a wrapper around a server implementation.
@@ -67,6 +69,19 @@ impl<C: LoadConfig> ServerRunner<C> {
6769 }
6870
6971 if config. is_monitored {
72+ let health_service =
73+ code0_flow:: flow_health:: HealthService :: new ( config. nats_url . clone ( ) ) ;
74+
75+ if let Ok ( address) = format ! ( "127.0.0.1:{}" , config. grpc_port) . parse ( ) {
76+ println ! ( "Health server started at {}" , address) ;
77+ let _ = Server :: builder ( )
78+ . add_service ( HealthServer :: new ( health_service) )
79+ . serve ( address)
80+ . await ;
81+ } else {
82+ println ! ( "Failed to parse address, starting without health server" ) ;
83+ }
84+
7085 todo ! ( "Start the HealthServer" ) ;
7186 }
7287
Original file line number Diff line number Diff line change @@ -25,15 +25,13 @@ impl AdapterStore {
2525
2626 let jetstream = async_nats:: jetstream:: new ( client. clone ( ) ) ;
2727
28- let res = jetstream
28+ let _ = jetstream
2929 . create_key_value ( Config {
3030 bucket : bucket. clone ( ) ,
3131 ..Default :: default ( )
3232 } )
3333 . await ;
3434
35- println ! ( "{:?}" , & res) ;
36-
3735 let kv = match jetstream. get_key_value ( bucket) . await {
3836 Ok ( kv) => kv,
3937 Err ( err) => panic ! ( "Failed to get key-value store: {}" , err) ,
You can’t perform that action at this time.
0 commit comments