jinnovation / kele.el

🥤 Spritzy Kubernetes cluster management for Emacs
https://jonathanj.in/kele.el/
Apache License 2.0
72 stars 4 forks source link

Minor suggestions #220

Open alphapapa opened 1 month ago

alphapapa commented 1 month ago

Hi,

FYI, in this code:

https://github.com/jinnovation/kele.el/blob/d50dd190807fd466fe078afe1c156cc463ecc102/kele.el#L591-L592

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