-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Indexer-Grpc-V2] Add GrpcManagerService. #15726
Conversation
⏱️ 1h 39m total CI duration on this PR
🚨 2 jobs on the last run were significantly faster/slower than expected
|
449a3b5
to
cf77eeb
Compare
) -> Result<Response<TransactionsResponse>, Status> { | ||
let request = request.into_inner(); | ||
let transactions = vec![]; | ||
// TODO(grao): Implement., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a stray comma after Implement
in the TODO comment.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
cf77eeb
to
6efa576
Compare
6efa576
to
fe81cff
Compare
fe81cff
to
0ff320c
Compare
pub struct IndexerGrpcManagerConfig { | ||
pub(crate) chain_id: u64, | ||
pub(crate) service_config: ServiceConfig, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IndexerGrpcManagerConfig
struct is missing several fields that are referenced in GrpcManager::new()
:
self_advertised_address
grpc_manager_addresses
fullnode_addresses
These fields need to be added to maintain consistency between the config struct and its usage. The current implementation will fail to compile since these fields are required by the manager initialization.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
tokio_scoped::scope(|s| { | ||
s.spawn(async move { | ||
self.metadata_manager.start().await.unwrap(); | ||
}); | ||
s.spawn(async move { | ||
info!("Starting GrpcManager at {}.", service_config.listen_address); | ||
server.serve(service_config.listen_address).await.unwrap(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tokio_scoped::scope()
block is missing an .await
, which means the spawned tasks will terminate immediately. Adding .await
ensures the tasks continue running:
tokio_scoped::scope(|s| {
// ...
}).await;
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
0ff320c
to
28b1410
Compare
tokio_scoped::scope(|s| { | ||
s.spawn(async move { | ||
info!("Starting GrpcManager at {}.", service_config.listen_address); | ||
server.serve(service_config.listen_address).await.unwrap(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using tokio_scoped::scope
here will cause the server to terminate immediately since the scope exits when the spawned task is created. To keep the server running, either use tokio::spawn
directly or implement a mechanism to keep the scope alive (e.g. through a shutdown signal handler). The current implementation will not serve any requests.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
77618df
to
ee7c3ae
Compare
let _request = request.into_inner(); | ||
let transactions = vec![]; | ||
// TODO(grao): Implement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this method is not yet implemented, returning an empty vector could silently mask errors for clients. Consider returning Status::unimplemented()
until the full implementation is ready. This makes the incomplete state explicit rather than implying the request succeeded with no data.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
} | ||
|
||
impl GrpcManager { | ||
pub(crate) async fn new(config: &IndexerGrpcManagerConfig) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be async?
static GRPC_MANAGER: OnceCell<GrpcManager> = OnceCell::const_new(); | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize)] | ||
pub(crate) struct ServiceConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to have a custom health check endpoint so that k8s can kick-in to restart the pod if error happens? or the design is service can restart itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will come up with something later.
// future. | ||
if let Some(address) = self.pick_live_data_service(starting_version) { | ||
address | ||
} else if let Some(address) = self.pick_historical_data_service(starting_version).await { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ee7c3ae
to
2acf36b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
How Has This Been Tested?
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist