Expand the timing arguments run-for-a-while takes --> to head
Sun Jul 3 08:26:55 UTC 2011 pix@kepibu.org
* Fix some problems discovered on fresh-load
Fri Jul 1 22:52:58 UTC 2011 pix@kepibu.org
* Expand the timing arguments run-for-a-while takes
diff -rN -u old-claki/claki.asd new-claki/claki.asd
--- old-claki/claki.asd 2013-07-23 18:30:52.000000000 +0000
+++ new-claki/claki.asd 2013-07-23 18:30:52.000000000 +0000
@@ -1,3 +1,3 @@
(defsystem :claki
- :depends-on (:oh-ducks :closure-html :cl-unification :drakma :alexandria :rucksack)
+ :depends-on (:oh-ducks :closure-html :cl-unification :drakma :alexandria :rucksack :local-time)
:components ((:file "claki")))
diff -rN -u old-claki/claki.lisp new-claki/claki.lisp
--- old-claki/claki.lisp 2013-07-23 18:30:52.000000000 +0000
+++ new-claki/claki.lisp 2013-07-23 18:30:52.000000000 +0000
@@ -243,15 +243,16 @@
(defun seconds (s) s)
(defun minutes (m) (* (seconds 60) m))
(defun hours (h) (* (minutes 60) h))
+(defun days (d) (* (hours 24) d))
(defun plus-or-minus (x y) (+ (- x y) (random (* 2 y))))
(defconstant +simple-time+ '(:year #\- (:month 2) #\- (:day 2) #\Space (:hour 2) #\: (:min 2) #\: (:sec 2)))
(defun now () (local-time:format-timestring nil (local-time:now) :format +simple-time+))
-(defun run-for-a-while (times)
+(defun run-for-a-while (how-long how-often variance)
(format t "; Beginning run at ~a~%" (now))
- (dotimes (i times)
- (sleep (minutes (plus-or-minus 30 5)))
+ (dotimes (i (floor how-long how-often))
+ (sleep (plus-or-minus how-often variance))
(format t "; Unattended run at ~a~%" (now))
(unattended-revert-new-spam)
(save-state))
@@ -259,10 +260,10 @@
#+(or)
(let ((stdout *standard-output*))
- (sb-thread:make-thread (lambda () (let ((*standard-output* stdout)) (run-for-a-while (* 2 48))))
+ (sb-thread:make-thread (lambda () (let ((*standard-output* stdout)) (run-for-a-while (days 2) (minutes 30) (minutes 5))))
:name "cliki reverter"))
-(defvar *state-file* (merge-pathnames #p"state/" (directory-namestring (or #.*load-pathname* #p"/home/pixel/repos/"))))
+(defvar *state-file* (merge-pathnames #p"state/" (directory-namestring (or #.*load-pathname* #p"/home/pixel/repos/claki/"))))
(defmacro with-rucksack-and-transaction ((rucksack) (&rest root-vars) &body body)
(with-unique-names (rest)