[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/el-job 3d59e81d41 094/143: Polish
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/el-job 3d59e81d41 094/143: Polish |
Date: |
Fri, 21 Mar 2025 19:00:32 -0400 (EDT) |
branch: elpa/el-job
commit 3d59e81d412ee22479b40571a41d70004c7fda73
Author: Martin Edström <meedstrom91@gmail.com>
Commit: Martin Edström <meedstrom91@gmail.com>
Polish
---
el-job.el | 49 ++++++++++++++++++++++++-------------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/el-job.el b/el-job.el
index 6bccf0f4ea..57423d92f7 100644
--- a/el-job.el
+++ b/el-job.el
@@ -421,7 +421,7 @@ still at work. IF-BUSY may take on one of three symbols:
load-features
inject-vars
funcall-per-input)
- (el-job--exec-pending-workload anonymous-job))
+ (el-job--exec-workload anonymous-job))
(let ((job (or (gethash id el-jobs)
(puthash id (el-job--make :id id) el-jobs)))
(do-respawn nil)
@@ -458,7 +458,7 @@ still at work. IF-BUSY may take on one of three symbols:
(when do-respawn
(el-job--disable job)
(apply #'el-job--spawn-processes .spawn-args))
- (el-job--exec-pending-workload job)))))))
+ (el-job--exec-workload job)))))))
(defvar-local el-job-here nil)
(defun el-job--spawn-processes (job load-features inject-vars
funcall-per-input)
@@ -521,7 +521,7 @@ For the rest of the arguments, see `el-job-launch'."
(el-job--disable job)
(el-job--dbg 1 "el-job: Terminated job because of: %S" err))))))
-(defun el-job--exec-pending-workload (job)
+(defun el-job--exec-workload (job)
"Split the queued inputs in JOB and pass to all children.
This puts them to work. Each successful child will print output
@@ -564,13 +564,22 @@ should trigger `el-job--handle-output'."
;; Polling: simplistic but reliable.
;; Had the clever idea to add a hook to `after-change-functions' in each
-;; process buffer to simply check (eq (char-before) ?\n) as output came in.
+;; process buffer, that checks (eq (char-before) ?\n). Perf was good on my
+;; machine...on Emacs 30, bad on 29. Plus it just seems the kinda design that
+;; invites variance from machine to machine.
-;; Perf was good on my machine...on Emacs 30, bad on 29. And it just seems
-;; like the kinda design that invites wild variance from machine to machine.
+;; So, poll. We do a chain of timers that successively ups the delay.
+;; To see what the delays would be, eval:
+;; (--map (/ it (float (ash 1 5))) (-iterate '1+ 1 42))
+
+;; And to see the cumulative sums:
+;; (-reductions '+ (--map (/ it (float (ash 1 5))) (-iterate '1+ 1 42)))
+
+;; As you can see, we do 7 polls inside the first second,
+;; but spread out the last 7 polls between T-minus-20s and T-minus-30s.
(defun el-job--poll (n bufs)
- (let (busy-bufs)
+ (let (busy-bufs id)
(save-current-buffer
(dolist (buf bufs)
(if (not (buffer-live-p buf))
@@ -579,26 +588,16 @@ should trigger `el-job--handle-output'."
(if (eq (char-before) ?\n)
(el-job--handle-output)
(push buf busy-bufs))))
-
- ;; We do a chain of timers that successively ups the delay.
- ;; To see what the delays would be, eval:
- ;; (--map (/ (float it) (ash 1 5)) (-iterate '1+ 1 42))
-
- ;; And to see the cumulative sums:
- ;; (-reductions '+ (--map (/ (float it) (ash 1 5)) (-iterate '1+ 1 42)))
- ;; As you can see, we do 7 polls inside the first second,
- ;; but spread the last 7 polls between T-minus-20s and T-minus-30s.
(if (and busy-bufs (<= n 42))
(setf (el-job:poll-timer el-job-here)
(run-with-timer
- (/ (float n) (ash 1 5)) nil #'el-job--poll (1+ n) busy-bufs))
- (let ((desc (or (el-job:id el-job-here)
- (format "once-off job that calls %S"
- (car (last (el-job:spawn-args
el-job-here)))))))
- (el-job--disable el-job-here)
- (if busy-bufs
- (message "el-job: Timed out, was busy for 30+ seconds: %s" desc)
- (el-job--dbg 2 "Reaped idle processes for %s" desc)))))))
+ (/ n (float (ash 1 5))) nil #'el-job--poll (1+ n) busy-bufs))
+ (el-job--disable el-job-here)
+ (if busy-bufs
+ (message "el-job: Timed out, was busy for 30+ seconds: %s"
+ (el-job:id el-job-here))
+ (el-job--dbg 2 "Reaped idle processes for %s"
+ (el-job:id el-job-here)))))))
(defun el-job--handle-output ()
"Handle output in current buffer.
@@ -650,7 +649,7 @@ more input in the queue."
(funcall .callback .merged-results job))
(if .id
(when .queued-inputs
- (el-job--exec-pending-workload job))
+ (el-job--exec-workload job))
;; Always clean up process buffers of anonymous job
(el-job--disable job)))))))
- [nongnu] elpa/el-job bbaf49fa17 056/143: Turn an error into polite debug message, (continued)
- [nongnu] elpa/el-job bbaf49fa17 056/143: Turn an error into polite debug message, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 70bdb8fea5 055/143: Polish, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job ad229ec4ba 110/143: CI, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 96c1d0bf4f 119/143: Safer let-binding inside while-loop, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job bbf11134fb 060/143: Merge branch 'dev', ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 2b52e884cc 117/143: Lint, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 01b330043c 010/143: ., ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 6323ebbb67 014/143: Separate child init from accepting input, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 40f86f79fc 028/143: Clarifications, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 15b821ebb2 086/143: Don't handle deprecated usage, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 3d59e81d41 094/143: Polish,
ELPA Syncer <=
- [nongnu] elpa/el-job a70b492bf4 105/143: Release version 2.1.0, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 73835a02a0 103/143: Try to be compatible with Emacs 28, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job ca15123593 064/143: Readme, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 349761d380 120/143: Add checkdoc to CI, without ispell, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job d501872523 118/143: Lint, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 6f93dc82bd 121/143: Add obsolete internal alias to ease upgrade-in-running-Emacs, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 27cf46baf0 123/143: Hotfix, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job db9bf6156c 124/143: Release version 2.2.1, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job 2e4a808996 125/143: Simplify locate-lib-in-load-history, ELPA Syncer, 2025/03/21
- [nongnu] elpa/el-job bcd43d6f2e 122/143: Polish, ELPA Syncer, 2025/03/21