jinnovation/kele.el

Minor suggestions

Opened this issue · 0 comments

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. :)