Function: ghub-wait
ghub-wait is a byte-compiled function defined in ghub.el.
Signature
(ghub-wait RESOURCE &optional DURATION &key USERNAME AUTH HOST FORGE)
Documentation
Busy-wait up to DURATION seconds for RESOURCE to become available.
DURATION specifies how many seconds to wait at most. It defaults to 64 seconds. The first attempt is made immediately, the second after two seconds, and each subsequent attempt is made after waiting as long again as we already waited between all preceding attempts combined.
See ghub-request for information about the other arguments.
Source Code
;; Defined in ~/.emacs.d/elpa/ghub-20260401.1239/ghub.el
(cl-defun ghub-wait (resource
&optional duration
&key username auth host forge)
"Busy-wait up to DURATION seconds for RESOURCE to become available.
DURATION specifies how many seconds to wait at most. It defaults
to 64 seconds. The first attempt is made immediately, the second
after two seconds, and each subsequent attempt is made after
waiting as long again as we already waited between all preceding
attempts combined.
See `ghub-request' for information about the other arguments."
(unless duration
(setq duration 64))
(with-local-quit
(let ((total 0))
(while (not (ghub-request "GET" resource nil
:noerror t
:username username
:auth auth
:host host
:forge forge))
(message "Waited (%3ss of %ss) for %s..." total duration resource)
(if (= total duration)
(error "%s is taking too long to create %s"
(if forge (capitalize (symbol-name forge)) "Github")
resource)
(if (> total 0)
(let ((wait (min total (- duration total))))
(sit-for wait)
(cl-incf total wait))
(sit-for (setq total 2))))))))