mirror of https://codeberg.org/cage/tinmop/
- prevent adding duplicate entries in +table-pagination-status+
This could happened when concurrent fetching messages command was launched from the user.
This commit is contained in:
parent
0f8c0802c9
commit
45a56fcf11
19
src/db.lisp
19
src/db.lisp
|
@ -1936,10 +1936,21 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||||
(defun first-pagination-status-id-timeline-folder (timeline folder)
|
(defun first-pagination-status-id-timeline-folder (timeline folder)
|
||||||
(first-status-id-timeline-folder-table timeline folder :pagination-status))
|
(first-status-id-timeline-folder-table timeline folder :pagination-status))
|
||||||
|
|
||||||
(defun add-to-pagination-status (status-id folder timeline)
|
(defun find-pagination-status (status-id folder timeline)
|
||||||
(query (make-insert +table-pagination-status+
|
(fetch-single (select :*
|
||||||
(:status-id :folder :timeline)
|
(from +table-pagination-status+)
|
||||||
(status-id folder timeline))))
|
(where (:and (:= :status-id status-id)
|
||||||
|
(:= :folder folder)
|
||||||
|
(:= :timeline timeline))))))
|
||||||
|
|
||||||
|
(defun add-to-pagination-status (status-id folder timeline &key (ensure-no-duplicates nil))
|
||||||
|
(let ((no-duplicate-p (if ensure-no-duplicates
|
||||||
|
(not (find-pagination-status status-id folder timeline))
|
||||||
|
t)))
|
||||||
|
(when no-duplicate-p
|
||||||
|
(query (make-insert +table-pagination-status+
|
||||||
|
(:status-id :folder :timeline)
|
||||||
|
(status-id folder timeline))))))
|
||||||
|
|
||||||
(defun remove-pagination-status (folder timeline)
|
(defun remove-pagination-status (folder timeline)
|
||||||
"Removes all the pagination data (i.e. all columns from table
|
"Removes all the pagination data (i.e. all columns from table
|
||||||
|
|
|
@ -761,6 +761,7 @@
|
||||||
:first-ignored-status-id-timeline-folder
|
:first-ignored-status-id-timeline-folder
|
||||||
:last-pagination-status-id-timeline-folder
|
:last-pagination-status-id-timeline-folder
|
||||||
:first-pagination-status-id-timeline-folder
|
:first-pagination-status-id-timeline-folder
|
||||||
|
:find-pagination-status
|
||||||
:add-to-pagination-status
|
:add-to-pagination-status
|
||||||
:remove-pagination-status
|
:remove-pagination-status
|
||||||
:count-status-marked-to-delete
|
:count-status-marked-to-delete
|
||||||
|
|
|
@ -860,7 +860,7 @@
|
||||||
(with-accessors ((status-id status-id)
|
(with-accessors ((status-id status-id)
|
||||||
(timeline timeline)
|
(timeline timeline)
|
||||||
(folder folder)) object
|
(folder folder)) object
|
||||||
(db:add-to-pagination-status status-id folder timeline)))
|
(db:add-to-pagination-status status-id folder timeline :ensure-no-duplicates t)))
|
||||||
|
|
||||||
(defclass poll-vote-event (program-event)
|
(defclass poll-vote-event (program-event)
|
||||||
((poll-id
|
((poll-id
|
||||||
|
|
Loading…
Reference in New Issue