Sun Jul  3 08:26:55 UTC 2011  pix@kepibu.org
  * Fix some problems discovered on fresh-load
hunk ./claki.asd 2
-  :depends-on (:oh-ducks :closure-html :cl-unification :drakma :alexandria :rucksack)
+  :depends-on (:oh-ducks :closure-html :cl-unification :drakma :alexandria :rucksack :local-time)
hunk ./claki.lisp 266
-(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/"))))
Fri Jul  1 22:52:58 UTC 2011  pix@kepibu.org
  * Expand the timing arguments run-for-a-while takes
hunk ./claki.lisp 246
+(defun days (d) (* (hours 24) d))
hunk ./claki.lisp 252
-(defun run-for-a-while (times)
+(defun run-for-a-while (how-long how-often variance)
hunk ./claki.lisp 254
-  (dotimes (i times)
-    (sleep (minutes (plus-or-minus 30 5)))
+  (dotimes (i (floor how-long how-often))
+    (sleep (plus-or-minus how-often variance))
hunk ./claki.lisp 263
-   (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))))
Wed Jun 29 03:08:25 UTC 2011  pix@kepibu.org
  * Wrap drakma:http-request so we can have automatic retries on timeouts
hunk ./claki.lisp 9
+(defun http-request (&rest drakma-args)
+  "A wrapper around drakma:http-request which automatically retries the request
+in the event of a timeout."
+  (let ((times-failed 0))
+    (tagbody
+     :fetch-page
+       (handler-case (return-from http-request (apply #'drakma:http-request drakma-args))
+         (usocket:timeout-error ()
+           (sleep (* 60 (expt 2 times-failed)))
+           (incf times-failed)
+           (go :fetch-page))))))
+
hunk ./claki.lisp 25
-      (drakma:http-request (format nil "http://cliki.net/~a" url)
-                           :additional-headers (when (gethash url *last-modified*)
-                                                 `((:if-modified-since (gethash url *last-modified*)))))
+      (http-request (format nil "http://cliki.net/~a" url)
+                    :additional-headers (when (gethash url *last-modified*)
+                                          `((:if-modified-since (gethash url *last-modified*)))))
hunk ./claki.lisp 191
-      (drakma:http-request (format nil "http://cliki.net/edit/~a" url)
-                           :method :post
-                           :parameters `(("version" . ,current-version)
-                                         ("T0"      . "BODY")
-                                         ("E0"      . ,(get-cliki-source url to-version))
-                                         ("summary" . "Spam detected, reverting to Known-Good.")
-                                         ("captcha" . "lisp")
-                                         ("name"    . "Claki (Revertobot Beta)")))
+      (http-request (format nil "http://cliki.net/edit/~a" url)
+                    :method :post
+                    :parameters `(("version" . ,current-version)
+                                  ("T0"      . "BODY")
+                                  ("E0"      . ,(get-cliki-source url to-version))
+                                  ("summary" . "Spam detected, reverting to Known-Good.")
+                                  ("captcha" . "lisp")
+                                  ("name"    . "Claki (Revertobot Beta)")))
hunk ./claki.lisp 213
-          (drakma:http-request (format nil "http://cliki.net/~a?source&v=~a" url version))
+          (http-request (format nil "http://cliki.net/~a?source&v=~a" url version))
Tue Jun 28 17:03:09 UTC 2011  pix@kepibu.org
  * Make #'run-for-a-while take the number of iterations as an argument
hunk ./claki.lisp 239
-(defun run-for-a-while ()
+(defun run-for-a-while (times)
hunk ./claki.lisp 241
-  (dotimes (i (* 2 24))
+  (dotimes (i times)
hunk ./claki.lisp 250
-   (sb-thread:make-thread (lambda () (let ((*standard-output* stdout)) (run-for-a-while)))
+   (sb-thread:make-thread (lambda () (let ((*standard-output* stdout)) (run-for-a-while (* 2 48))))
Tue Jun 28 08:05:37 UTC 2011  pix@kepibu.org
  * Padding for time numbers, so we get 01 instead of 1
hunk ./claki.lisp 236
-(defconstant +simple-time+ '(:year #\- :month #\- :day #\Space :hour #\: :min #\: :sec))
+(defconstant +simple-time+ '(:year #\- (:month 2) #\- (:day 2) #\Space (:hour 2) #\: (:min 2) #\: (:sec 2)))