Skip to main content

request_once

Function request_once 

Source
pub fn request_once(
    ctx: &ServiceContext,
    peer: &str,
    msg: &Message,
    secs: i64,
) -> Result<Message, Error>
Expand description

request_within with NO retry: one send, one bounded wait, and the reason it failed.

For a caller that owns its own recovery - one that reacquires and says so in its log, or that does pace and retry a full queue because it knows its peer drains fast. The four failures are the ones request_within tells apart, and nothing is done about any of them:

  • Error::Unreachable - the request never left (a stale capability, a peer mid-restart). Nothing happened; reacquire the name (crate::cap::reacquire) and ask again if you want to.
  • Error::Busy - the peer’s queue was full. Nothing happened.
  • Error::OutcomeUnknown - no reply in time. It may have happened.
  • Error::PeerDied - it arrived and the peer died before answering. It may have happened; reacquire before asking again, and ask again only if the operation is safe to repeat.

Prefer request_within, which does the one safe retry for you. This exists so that a caller with a different, deliberate policy does not have to leave the library to keep it.