From unknown Sat Jun 14 03:51:31 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50634 <50634@debbugs.gnu.org> To: bug#50634 <50634@debbugs.gnu.org> Subject: Status: [PATCH] progress: Rate limit drawing in the progress-reporter/bar. Reply-To: bug#50634 <50634@debbugs.gnu.org> Date: Sat, 14 Jun 2025 10:51:31 +0000 retitle 50634 [PATCH] progress: Rate limit drawing in the progress-reporter= /bar. reassign 50634 guix-patches submitter 50634 Christopher Baines severity 50634 normal tag 50634 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 17 06:16:01 2021 Received: (at submit) by debbugs.gnu.org; 17 Sep 2021 10:16:01 +0000 Received: from localhost ([127.0.0.1]:58570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRAuX-0004f4-5I for submit@debbugs.gnu.org; Fri, 17 Sep 2021 06:16:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:35180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRAuW-0004ew-9T for submit@debbugs.gnu.org; Fri, 17 Sep 2021 06:16:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRAuW-0004Gl-3j for guix-patches@gnu.org; Fri, 17 Sep 2021 06:16:00 -0400 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:36301) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRAuU-0002p0-8L for guix-patches@gnu.org; Fri, 17 Sep 2021 06:15:59 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id B9EF327BBE1 for ; Fri, 17 Sep 2021 11:15:56 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a8a3a10f for ; Fri, 17 Sep 2021 10:15:56 +0000 (UTC) From: Christopher Baines To: guix-patches@gnu.org Subject: [PATCH] progress: Rate limit drawing in the progress-reporter/bar. Date: Fri, 17 Sep 2021 11:15:56 +0100 Message-Id: <20210917101556.13071-1-mail@cbaines.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) This helps smooth the output in cases where the bar is updated very quickly, for example in guix weather where it's computing derivations. * guix/progress.scm (progress-reporter/bar): Wrap the drawing code with the rate-limited procedure. --- guix/progress.scm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/guix/progress.scm b/guix/progress.scm index 0cbc804ec1..4f8e98edc0 100644 --- a/guix/progress.scm +++ b/guix/progress.scm @@ -270,19 +270,25 @@ ABBREVIATION used to shorten FILE for display." tasks is performed. Write PREFIX at the beginning of the line." (define done 0) + (define (draw-bar) + (let* ((ratio (* 100. (/ done total)))) + (erase-current-line port) + (if (string-null? prefix) + (display (progress-bar ratio (current-terminal-columns)) port) + (let ((width (- (current-terminal-columns) + (string-length prefix) 3))) + (display prefix port) + (display " " port) + (display (progress-bar ratio width) port))) + (force-output port))) + + (define draw-bar/rate-limited + (rate-limited draw-bar %progress-interval)) + (define (report-progress) (set! done (+ 1 done)) (unless (> done total) - (let* ((ratio (* 100. (/ done total)))) - (erase-current-line port) - (if (string-null? prefix) - (display (progress-bar ratio (current-terminal-columns)) port) - (let ((width (- (current-terminal-columns) - (string-length prefix) 3))) - (display prefix port) - (display " " port) - (display (progress-bar ratio width) port))) - (force-output port)))) + (draw-bar/rate-limited))) (progress-reporter (start (lambda () -- 2.33.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 30 17:05:49 2021 Received: (at 50634) by debbugs.gnu.org; 30 Sep 2021 21:05:49 +0000 Received: from localhost ([127.0.0.1]:54159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW3FU-0006DP-Sz for submit@debbugs.gnu.org; Thu, 30 Sep 2021 17:05:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW3FU-0006DE-4a for 50634@debbugs.gnu.org; Thu, 30 Sep 2021 17:05:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60112) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mW3FL-0006EV-Tx; Thu, 30 Sep 2021 17:05:41 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36448 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mW3Ey-0004We-AD; Thu, 30 Sep 2021 17:05:39 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Christopher Baines Subject: Re: bug#50634: [PATCH] progress: Rate limit drawing in the progress-reporter/bar. References: <20210917101556.13071-1-mail@cbaines.net> Date: Thu, 30 Sep 2021 23:05:10 +0200 In-Reply-To: <20210917101556.13071-1-mail@cbaines.net> (Christopher Baines's message of "Fri, 17 Sep 2021 11:15:56 +0100") Message-ID: <87y27d22rd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50634 Cc: 50634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Christopher, Christopher Baines skribis: > This helps smooth the output in cases where the bar is updated very quick= ly, > for example in guix weather where it's computing derivations. > > * guix/progress.scm (progress-reporter/bar): Wrap the drawing code with t= he > rate-limited procedure. I hit that problem quite frequently lately in shell-mode so I=E2=80=99m gra= teful you fixed it. Go for it! Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 12 10:24:25 2021 Received: (at 50634-done) by debbugs.gnu.org; 12 Dec 2021 15:24:25 +0000 Received: from localhost ([127.0.0.1]:52899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwQi9-0007Xi-K8 for submit@debbugs.gnu.org; Sun, 12 Dec 2021 10:24:25 -0500 Received: from mira.cbaines.net ([212.71.252.8]:47054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwQi7-0007Xa-9D for 50634-done@debbugs.gnu.org; Sun, 12 Dec 2021 10:24:23 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 44FE027BBE9; Sun, 12 Dec 2021 15:24:22 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 56b5cd9c; Sun, 12 Dec 2021 15:24:21 +0000 (UTC) References: <20210917101556.13071-1-mail@cbaines.net> <87y27d22rd.fsf@gnu.org> User-agent: mu4e 1.6.6; emacs 27.2 From: Christopher Baines To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#50634: [PATCH] progress: Rate limit drawing in the progress-reporter/bar. Date: Sun, 12 Dec 2021 15:23:32 +0000 In-reply-to: <87y27d22rd.fsf@gnu.org> Message-ID: <87y24pzw0t.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50634-done Cc: 50634-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi Christopher, > > Christopher Baines skribis: > >> This helps smooth the output in cases where the bar is updated very quic= kly, >> for example in guix weather where it's computing derivations. >> >> * guix/progress.scm (progress-reporter/bar): Wrap the drawing code with = the >> rate-limited procedure. > > I hit that problem quite frequently lately in shell-mode so I=E2=80=99m g= rateful > you fixed it. Go for it! I seemingly forgot about this, but I've now pushed this patch as 604880ae22e1a7662acb1d3f282242470de0cd03. Thanks, Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmG2FCNfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9Xf17w/+PFsIASDI8qcqaBkU0+nkDK6RmWhJAr4C dyiCaujjv8fJVqaNjW7NMcp8DkHA95ccM0TGKfg7kR88F7ApZ1AOMLGThFns++kO b97PAsfpI2Tp25lb9mKcjHKUWpKSw402KVOngOzPHs/8y2ue95KcJVVoKsFsYGHO zaAKEsTzLIFDElNnzovFL0rxE3lN33chEVxZMb8EytdA6mF88f9+fEtbYBNGubbb FJHMsrco8YCy84CHXi1/Jl3Vi3U8cVeMYjxN8bUOp8BJDO6AR6jvdQcAeqvx9lrm iZWTKEMwa4+zDAZQJXDfjAx3CpyRK7zFiGBXFQXxQzj0a4DH4+B+WGacb5MBSYtu JnyG+j5fkvrXcN1RdcpHP/l20do08+Cln/nzmzXq1OVc5EvIZ3gsqjhLFMEmP7Uj GqJQ6oBtvE4+55dEpOSD1jBvg7gRv+N7MO7wbZi8sPUZiWKO+RGdvKnXFXy8eORj OiosStu3y8iQ7Z15qz+f0+nu5Q1nOLdksmsay3/uemUZ1dpchSWxCtTPrqvJfkNx 2h7ep6NQusJBZRBeyTcVmO2ZWAlsLrcjEhwz24nLvPLRxMDAp5mPk/NdAU4IRzRX 8LbIbTtMNdsEBOaocKs7CHD+HxSrRB4onxNIy07VifG91vq5H+5ym3KqNdAD1p8B vxauUTJ4QyY= =AKmX -----END PGP SIGNATURE----- --=-=-=-- From unknown Sat Jun 14 03:51:31 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 10 Jan 2022 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator