[#4551] fix error on fetching history for removed chat
This commit is contained in:
parent
9058c54933
commit
5d41cdda0c
|
@ -371,7 +371,10 @@
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:inbox/check-fetching
|
:inbox/check-fetching
|
||||||
(fn [{:keys [db now] :as cofx} [_ last-request chat-id]]
|
(fn [{:keys [db now] :as cofx} [_ last-request chat-id]]
|
||||||
(when (:inbox/fetching? db)
|
(when (and (:inbox/fetching? db)
|
||||||
|
;; if chat was removed before messages were fetched no need
|
||||||
|
;; to proceed with further actions
|
||||||
|
(or (not chat-id) (contains? (:transport/chats db) chat-id)))
|
||||||
(let [time-since-last-received (- now (:inbox/last-received db))]
|
(let [time-since-last-received (- now (:inbox/last-received db))]
|
||||||
(if (> time-since-last-received fetching-timeout)
|
(if (> time-since-last-received fetching-timeout)
|
||||||
(if chat-id
|
(if chat-id
|
||||||
|
|
Loading…
Reference in New Issue