Skip to content

Commit

Permalink
track time of last successful discovery cache poll
Browse files Browse the repository at this point in the history
  • Loading branch information
jinnovation committed Apr 10, 2024
1 parent d486010 commit be3a8a7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kele.el
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ pods."
:type 'integer
:group 'kele)

(defvar kele--discovery-last-refresh-time nil
"Timestamp of last successful poll of the discovery cache.")

;; TODO (#80): Display in the `kele-get-mode' header what fields were filtered out
(defcustom kele-filtered-fields '((metadata managedFields)
(metadata annotations kubectl.kubernetes.io/last-applied-configuration))
Expand Down Expand Up @@ -328,7 +331,8 @@ retval into `async-wait'."
(let* ((progress-reporter (make-progress-reporter "Pulling discovery cache..."))
(func-complete (lambda (res)
(oset cache contents res)
(progress-reporter-done progress-reporter))))
(progress-reporter-done progress-reporter)
(setq kele--discovery-last-refresh-time (current-time)))))
(async-start `(lambda ()
(add-to-list 'load-path (file-name-directory ,(locate-library "dash")))
(add-to-list 'load-path (file-name-directory ,(locate-library "f")))
Expand Down Expand Up @@ -1703,14 +1707,15 @@ The `scope' is the current context name."
(transient-setup 'kele-proxy nil nil :scope (kele-current-context-name)))

;; TODO: Show:
;; - Time of last discovery cache sync
;; - Active proxy servers
(defun kele--help-echo ()
"Return text to display for help echo."
(let* ((ns (kele-current-namespace))
(msgs (list (format "Current context: %s" (kele-current-context-name)))))
(if ns
(setq msgs (append msgs (list (format "Current namespace: %s" ns)))))
(setq msgs (append msgs (list (format "Discovery cache last polled: %s"
(format-time-string "%F %T" kele--discovery-last-refresh-time)))))
(string-join msgs "\n")))

(provide 'kele)
Expand Down

0 comments on commit be3a8a7

Please sign in to comment.