From 119cd166dc0f8c3df069dcdd80dd80c8f3271cbd Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 24 May 2023 17:23:58 -0700 Subject: temporarily dropping update thread --- fussy.lisp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'fussy.lisp') diff --git a/fussy.lisp b/fussy.lisp index aabcd12..dca7139 100644 --- a/fussy.lisp +++ b/fussy.lisp @@ -135,7 +135,7 @@ differs from the theme-pkg instance already in the data store." ;; restart-case with some restarts or something later, or will ;; just catch the error in the caller of update-theme-packages (when themes-to-update - (format *standard-output* "Updating Themes~%") + (fussy-log "Updating Themes") ;; delete the temporary .emacs.d (uiop:delete-directory-tree (uiop:merge-pathnames* ".emacs.d/" (full-theme-image-directory)) @@ -150,7 +150,7 @@ differs from the theme-pkg instance already in the data store." (process-archive-theme archive-theme)) (reindex-themes-by-package) - (format *standard-output* "Done Updating Themes~%")))) + (fussy-log "Done Updating Themes")))) (defun all-theme-keywords () (delete-duplicates @@ -231,10 +231,11 @@ returns a list of those names." fussy-el :std "" :documentation "These paths are by default equal to the config directory.") + (logfile :std "fussy.log") (port :std 8888) (domain :std "localhost") (address :std "0.0.0.0") - (fetch-time :std (list 0 0) + (fetch-time :std (list 17 18) :documentation "(Hour Minute) at which fussy updates its themes."))) (defvar *config* nil) @@ -244,6 +245,18 @@ directory is used as a default directory for all relative paths mentioned in the config file. Any Absolute paths in the config file are treated as such.") +(defun fussy-log (msg &rest args) + (with-open-file (out (logfile *config*) + :direction :output + :if-exists :append + :if-does-not-exist :create) + (multiple-value-bind + (sec min hour date month year) (get-decoded-time) + (format out "~4d/~2,'0d/~2,'0d ~2,'0d:~2,'0d:~2,'0d " + year month date hour min sec)) + (apply #'format out msg args) + (terpri out))) + (defun load-config-from-file (file) (apply #'make-instance 'config @@ -289,7 +302,7 @@ that they are not loaded during image gen.") (defun format-emacs-evocation-script (package-names) (format nil - "env HOME=~a xvfb-run emacs -q --eval ~s --load ~a" + "env HOME=~a xvfb-run -a emacs -q --eval ~s --load ~a" (full-theme-image-directory) (generate-elisp-to-fetch-and-exclude package-names) (fussy-elisp-script-location))) @@ -326,17 +339,17 @@ that they are not loaded during image gen.") (defvar *fetcher-thread* nil) -(defparameter +twelve-hours+ (* 12 60 60)) - (defun start-fetch-thread () (setf *fetcher-thread* (bt:make-thread (lambda () + (fussy-log "Starting Fetcher Thread") (loop :while t :when (time-to-update-p) :do (handler-case (update-theme-packages) - (error (e) (format *error-output* "~a while updating." e))) - :do (sleep +twelve-hours+))) + (error (e) + (fussy-log "While updating: ~a" e))) + :do (sleep 60))) :name "Fussy fetch thread"))) (defun start (&key config-file) @@ -356,9 +369,9 @@ that they are not loaded during image gen.") :address (address *config*) :domain (domain *config*)))) (create-db) - ;(update-theme-packages) + (update-theme-packages) (reindex-themes-by-package) - (start-fetch-thread) + ;(start-fetch-thread) (lzb:install-app *server* (lzb:app 'fussy::fussy)) (lzb:start-server *server*)) -- cgit v1.2.3