Skip to content
Playground(another site)

bynk.race.in_agent_handler

Error a.race(b) was used in an agent handler, which has no execution context to hand the losing effect to.

race hands the side that loses to the execution context, and an agent handler has none. Call it from the service handler that calls the agent, so the race is run from outside. The same rule holds for bynk.within.in_agent_handler.

Example

agent Feed {
key id: String
on call quote() -> Effect[Int] {
Slow("a").get().race(Slow("b").get()) // ✗ an agent handler has no execution context
}
}
service quotes {
on call() -> Effect[Int] by Caller {
Slow("a").get().race(Slow("b").get()) // ✓ the service handler has
}
}

In the Book

See also

  • The grammar rule it governs: method_call.
  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.race.in_agent_handler shows the same from the installed toolchain, without a network.