28 Step&& step, std::string_view fallback) {
33 if (timeout_ns == 0) {
34 LOG_WARN(
"{}: stopping with {} order(s) working (cancel_on_stop_ms is 0)", who, working);
38 LOG_INFO(
"{}: stopping, cancelling {} working order(s)", who, working);
42 const bool worked = service(now_ns);
44 if (left.
waiting == 0 || now_ns >= deadline_ns) {
48 std::this_thread::yield();
52 LOG_INFO(
"{}: every working order is cancelled or filled", who);
54 LOG_ERROR(
"{}: {} order(s) may still be working ({} unconfirmed, {} on a session that is down) - {}", who,
KillSwitchCount run_kill_switch(std::string_view who, size_t working, uint64_t timeout_ns, Service &&service, Step &&step, std::string_view fallback)