Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor suggestions #220

Open
alphapapa opened this issue Jun 9, 2024 · 0 comments
Open

Minor suggestions #220

alphapapa opened this issue Jun 9, 2024 · 0 comments

Comments

@alphapapa
Copy link

alphapapa commented Jun 9, 2024

Hi,

FYI, in this code:

kele.el/kele.el

Lines 591 to 592 in d50dd19

(when-let* ((resp-ready (plz 'get ready-addr :as 'response :else 'ignore))
(resp-live (plz 'get live-addr :as 'response :else 'ignore))

Rather than pass :else 'ignore to plz, you should probably wrap plz in ignore-errors, because it appears that you want those requests to be synchronous.

Generally, you could probably simplify it like this:

(cl-defmethod ready-p ((proxy kele--proxy-record))
  "Return non-nil if the PROXY is ready for requests.

Returns nil on any curl error."
  (let ((ready-addr (format "%s/readyz" (kele--url proxy)))
        (live-addr (format "%s/livez" (kele--url proxy))))
    (ignore-errors
      (and (= 200 (plz-response-status (plz 'get ready-addr :as 'response)))
           (= 200 (plz-response-status (plz 'get live-addr :as 'response)))))))

The same is probably so for the earlier place in the file where a similar check is done. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant