Function unary
pub async fn unary<T, F, Fut>(
tokens: &Arc<TokenManager>,
timeout: Duration,
retry_unauth: bool,
f: F,
) -> Result<T, FinamError>Expand description
Runs f with a deadline. On UNAUTHENTICATED and retry_unauth renews the JWT and calls
once more. Never set retry_unauth for commands (no automatic retry of trading
commands).
A call that does not answer within timeout ends as status DEADLINE_EXCEEDED. The request may
still be running at the broker, which is why a command with this result is Unknown.
§Errors
[FinamError::Status] with the code of the server, or DEADLINE_EXCEEDED on a timeout. When the
renewal itself fails, its error is returned instead of the second call.
§Examples
See the module docs.