1
0
Fork 0

- 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:
cage 2020-06-13 13:02:23 +02:00
parent 0f8c0802c9
commit 45a56fcf11
3 changed files with 17 additions and 5 deletions

View File

@ -1936,10 +1936,21 @@ to `timeline' , `folder' and possibly `account-id', older than
(defun first-pagination-status-id-timeline-folder (timeline folder)
(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)
(fetch-single (select :*
(from +table-pagination-status+)
(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))))
(status-id folder timeline))))))
(defun remove-pagination-status (folder timeline)
"Removes all the pagination data (i.e. all columns from table

View File

@ -761,6 +761,7 @@
:first-ignored-status-id-timeline-folder
:last-pagination-status-id-timeline-folder
:first-pagination-status-id-timeline-folder
:find-pagination-status
:add-to-pagination-status
:remove-pagination-status
:count-status-marked-to-delete

View File

@ -860,7 +860,7 @@
(with-accessors ((status-id status-id)
(timeline timeline)
(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)
((poll-id