|
|
@@ -437,23 +437,26 @@
|
|
|
collect (cons chat-id (mapcar #'feed-url feeds))))
|
|
|
|
|
|
|
|
|
+(defvar *save-settings-lock* (bordeaux-threads:make-lock "save-settings-lock")
|
|
|
+ "Lock for multithreading access to write settings file")
|
|
|
(defun save-settings()
|
|
|
- (with-open-file (s (merge-pathnames "settings.lisp"
|
|
|
- (asdf:component-pathname
|
|
|
- (asdf:find-system '#:chatikbot)))
|
|
|
- :direction :output
|
|
|
- :if-exists :supersede
|
|
|
- :if-does-not-exist :create)
|
|
|
- (write '(in-package #:chatikbot) :stream s)
|
|
|
- (write
|
|
|
- `(setf *fsq-send-to* (alexandria:alist-hash-table ',(alexandria:hash-table-alist *fsq-send-to*))
|
|
|
- *chat-locations* ',*chat-locations*
|
|
|
- *akb-send-to* ',*akb-send-to*
|
|
|
- *akb-last-id* ,*akb-last-id*
|
|
|
- *rss-chat-feeds* (%load-rss-feeds ',(%save-rss-feeds))
|
|
|
- *per-minute-rates* (make-circular ',(flat-circular *per-minute-rates*)))
|
|
|
- :stream s)
|
|
|
- (values)))
|
|
|
+ (bordeaux-threads:with-lock-held (*save-settings-lock*)
|
|
|
+ (with-open-file (s (merge-pathnames "settings.lisp"
|
|
|
+ (asdf:component-pathname
|
|
|
+ (asdf:find-system '#:chatikbot)))
|
|
|
+ :direction :output
|
|
|
+ :if-exists :supersede
|
|
|
+ :if-does-not-exist :create)
|
|
|
+ (write '(in-package #:chatikbot) :stream s)
|
|
|
+ (write
|
|
|
+ `(setf *fsq-send-to* (alexandria:alist-hash-table ',(alexandria:hash-table-alist *fsq-send-to*))
|
|
|
+ *chat-locations* ',*chat-locations*
|
|
|
+ *akb-send-to* ',*akb-send-to*
|
|
|
+ *akb-last-id* ,*akb-last-id*
|
|
|
+ *rss-chat-feeds* (%load-rss-feeds ',(%save-rss-feeds))
|
|
|
+ *per-minute-rates* (make-circular ',(flat-circular *per-minute-rates*)))
|
|
|
+ :stream s)
|
|
|
+ (values))))
|
|
|
|
|
|
(defun start ()
|
|
|
;; Clear prev threads
|