-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Health endpoint #9847
Health endpoint #9847
Conversation
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.
Looks good, but I found the if
in status_error
a bit hard to spot i.e, to determine whether the node has no peers or is syncing!
@tomusdrw shall this be backported? |
@niklasad1 no, I don't think backporting is required - it's a new feature not really a bugfix. |
rpc/src/v1/impls/parity.rs
Outdated
@@ -481,4 +487,21 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where | |||
fn submit_work_detail(&self, nonce: H64, pow_hash: H256, mix_hash: H256) -> Result<H256> { | |||
helpers::submit_work_detail(&self.client, &self.miner, nonce, pow_hash, mix_hash) | |||
} | |||
|
|||
fn status(&self) -> Result<()> { | |||
let has_peers = self.client.spec_name() == "developmentchain" || self.sync.status().num_peers > 0; |
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.
Can't we have a more generic method to check if it's the dev
chain? Or couldn't it be the same check as for the light implementation?
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, was trying to look for any detection we do already, but haven't found anything.
In light we don't really have spec_name
exposed, but I agree that current way is suboptimal.
I'll try to figure something out.
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.
@ngotchac addressed, could you have a look?
Also please don't forget the doc 👼 |
Closes #7560
Closes #9401
Introduces new RPC method
parity_nodeStatus
that return OK in case the node is not syncing and you have at least one peer (exception: development chain).This method is then used as a health API of HTTP server.