فهرست منبع

Workaround chrome sometimes locking cookies database

Innocenty Enikeew 11 سال پیش
والد
کامیت
aad9109ea3
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 4 1
      src/utils.lisp
  2. 2 1
      timeliner.asd

+ 4 - 1
src/utils.lisp

@@ -111,6 +111,7 @@
 (defvar *chrome-cookie-file*
   (merge-pathnames #P".config/google-chrome/Default/Cookies"
                    (user-homedir-pathname)))
+(defparameter +temp-cookie-file+ #P"cookies.sqlite")
 
 (define-condition bad-encoding-error (simple-error) ())
 
@@ -124,7 +125,9 @@
                                            (elt value (1- (length value)))))) 'string))
 
 (defun load-chrome-cookie-jar (domain)
-  (sqlite:with-open-database (db *chrome-cookie-file*)
+  ;; Workaround chrome sometimes locking cookies database
+  (cl-fad:copy-file *chrome-cookie-file* +temp-cookie-file+ :overwrite t)
+  (sqlite:with-open-database (db +temp-cookie-file+)
     (make-instance 'drakma:cookie-jar
                    :cookies (loop
                                for (name host-key value path expires secure-p http-only-p encrypted)

+ 2 - 1
timeliner.asd

@@ -51,7 +51,8 @@ THE SOFTWARE.
                :clon
                :cl-oauth
                :cl-date-time-parser
-               :log4cl)
+               :log4cl
+               :cl-fad)
   :components ((:module "src"
                 :components
                 ((:file "utils")