Skip to content

Commit

Permalink
After an IPC error, wait a second before retrying.
Browse files Browse the repository at this point in the history
This avoids a rapid spin loop that generally makes the operating
system and the user most unhappy.
  • Loading branch information
avsm authored and andrenth committed Dec 2, 2013
1 parent d1ec148 commit eaec2ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib_test/helper.ml
Expand Up @@ -27,7 +27,8 @@ let main fd =
| `Response (SlaveIpcOps.Broadcast s) ->
Lwt_log.notice_f "got broadcast: %s" s
| _ ->
Lwt_log.error "helper IPC error" in
lwt () = Lwt_log.error "helper IPC error" in
Lwt_unix.sleep 1.0 in
bcast_ipc () in
bcast_ipc () in
ctrl_ipc_t <&> bcast_ipc_t
Expand Down
3 changes: 2 additions & 1 deletion lib_test/slave.ml
Expand Up @@ -19,7 +19,8 @@ let rec consume_ipc fd =
| `Response (SlaveIpcOps.Resp1 i | SlaveIpcOps.Resp2 i) ->
Lwt_log.notice_f "got response: %d" i
| `Timeout | `EOF ->
Lwt_log.error "direct IPC error" in
lwt () = Lwt_log.error "direct IPC error" in
Lwt_unix.sleep 1.0 in
consume_ipc fd

let rec produce_ipc fd =
Expand Down

0 comments on commit eaec2ae

Please sign in to comment.