From 082ae44ec7c03770a82fbf9453f7252ba5716d7e Mon Sep 17 00:00:00 2001 From: Fernando Gasperi Jabalera Date: Fri, 28 Feb 2020 02:12:22 -0800 Subject: [PATCH] Do not send task bar updates when progress bar is off Summary: When the progress bar was off (`--no-progress-bar`) the `TaskBar` didn't log updates but the workers still sent them to the master process. Now, the workers no longer send updates to the master process when the progress bar is off. Reviewed By: ngorogiannis Differential Revision: D20140577 fbshipit-source-id: 560d56991 --- infer/src/base/ProcessPool.ml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/infer/src/base/ProcessPool.ml b/infer/src/base/ProcessPool.ml index 91d8b3513..6e37eb232 100644 --- a/infer/src/base/ProcessPool.ml +++ b/infer/src/base/ProcessPool.ml @@ -391,13 +391,17 @@ let fork_child ~file_lock ~child_prelude ~slot (updates_r, updates_w) ~f ~epilog bar. This is because only the parent knows about all the children, hence it's in charge of actually updating the task bar. *) let update_status t status = - let status = - (* Truncate status if too big: it's pointless to spam the status bar with long status, and - also difficult to achieve technically over pipes (it's easier if all the messages fit - into a buffer of reasonable size). *) - if String.length status > 100 then String.subo ~len:100 status ^ "..." else status - in - send_to_parent (UpdateStatus (slot, t, status)) + match Config.progress_bar with + | `Quiet | `Plain -> + () + | `MultiLine -> + let status = + (* Truncate status if too big: it's pointless to spam the status bar with long status, and + also difficult to achieve technically over pipes (it's easier if all the messages fit + into a buffer of reasonable size). *) + if String.length status > 100 then String.subo ~len:100 status ^ "..." else status + in + send_to_parent (UpdateStatus (slot, t, status)) in ProcessPoolState.update_status := update_status ; let orders_ic = Unix.in_channel_of_descr to_child_r in