1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-21 08:50:51 +01:00

- added code to try to recover from a failed tag request.

This commit is contained in:
cage 2022-11-12 14:12:45 +01:00
parent ccff6616c4
commit c0cbe8f519
3 changed files with 45 additions and 28 deletions

View File

@ -377,6 +377,7 @@ Returns nil if the user did not provided a server in the configuration file"
(defun-api-call get-timeline-tag (tag &key min-id (limit 20)) (defun-api-call get-timeline-tag (tag &key min-id (limit 20))
"Gets messages that contains tags identified by parameter `tag'" "Gets messages that contains tags identified by parameter `tag'"
(restart-case
(tooter:timeline-tag *client* (tooter:timeline-tag *client*
tag tag
:local nil :local nil
@ -384,7 +385,17 @@ Returns nil if the user did not provided a server in the configuration file"
:max-id nil :max-id nil
:since-id nil :since-id nil
:min-id min-id :min-id min-id
:limit limit)) :limit limit)
(retry-ignoring-min-id ()
(ignore-errors
(tooter:timeline-tag *client*
tag
:local nil
:only-media nil
:max-id nil
:since-id nil
:min-id nil
:limit limit)))))
(defun-api-call update-timeline-tag (tag folder &key (defun-api-call update-timeline-tag (tag folder &key
(recover-count 0) (recover-count 0)
@ -395,7 +406,7 @@ Returns nil if the user did not provided a server in the configuration file"
reflectings the changes in the timeline (saves messages in the reflectings the changes in the timeline (saves messages in the
database etc.)" database etc.)"
(when tag (when tag
(let* ((timeline-statuses (get-timeline-tag tag (when-let* ((timeline-statuses (get-timeline-tag tag
:min-id min-id :min-id min-id
:limit limit)) :limit limit))
(trees (if command-line:*update-timeline-climb-message-tree* (trees (if command-line:*update-timeline-climb-message-tree*

View File

@ -21,11 +21,11 @@
(defun safe-parse-number (maybe-number &key (fix-fn #'(lambda (e) (declare (ignore e)) nil))) (defun safe-parse-number (maybe-number &key (fix-fn #'(lambda (e) (declare (ignore e)) nil)))
(handler-bind ((error (handler-bind ((error
(lambda(e) (lambda (e)
(return-from safe-parse-number (funcall fix-fn e))))) (return-from safe-parse-number (funcall fix-fn e)))))
(if (or (not (stringp maybe-number)) (if (or (not (stringp maybe-number))
(string= maybe-number "-")) (string= maybe-number "-"))
(error "Paring a non string element") (error "Parsing a non string element")
(parse-number:parse-number maybe-number)))) (parse-number:parse-number maybe-number))))
(defun parse-number-default (maybe-number default) (defun parse-number-default (maybe-number default)

View File

@ -473,7 +473,7 @@ Metadata includes:
(setf intersect-sorted (setf intersect-sorted
(remove window intersect-sorted)) (remove window intersect-sorted))
(setf intersect-sorted (setf intersect-sorted
(remove-if-not (lambda(a) (typep a 'main-window::focus-marked-window)) (remove-if-not (lambda (a) (typep a 'main-window::focus-marked-window))
intersect-sorted)) intersect-sorted))
(when intersect-sorted (when intersect-sorted
(remove-focus-to-all-windows) (remove-focus-to-all-windows)
@ -1025,7 +1025,13 @@ If some posts was deleted before, download them again."
(let* ((all-tags (db:all-subscribed-tags-name)) (let* ((all-tags (db:all-subscribed-tags-name))
(all-paginations (db:all-tag-paginations-status all-tags))) (all-paginations (db:all-tag-paginations-status all-tags)))
(flet ((update () (flet ((update ()
(client:update-subscribed-tags all-tags all-paginations) (handler-bind ((tooter:request-failed
(lambda (e)
(notify (format nil
(_ "Error getting the latest unread messages for tag ~a, trying fetching the latest")
(tooter:url e)))
(invoke-restart 'api-client::retry-ignoring-min-id))))
(client:update-subscribed-tags all-tags all-paginations))
(let ((update-got-message-event (let ((update-got-message-event
(make-instance 'tag-mark-got-messages-event)) (make-instance 'tag-mark-got-messages-event))
(notify-event (notify-event