Fix for inconsistent gap between messages (#421)
This commit is contained in:
parent
b51653fcd8
commit
2843aa2153
|
@ -386,7 +386,7 @@
|
|||
(fn [db [_ {:keys [chat-id clock-value] :as opts}]]
|
||||
(let [chat (if (chats/exists? chat-id)
|
||||
(let [{old-clock-value :clock-value :as chat} (chats/get-by-id chat-id)]
|
||||
(assoc chat :clock-value (+ (max old-clock-value clock-value)) 1))
|
||||
(assoc chat :clock-value (max old-clock-value clock-value)))
|
||||
(prepare-chat db chat-id opts))]
|
||||
(chats/save chat)
|
||||
(update-in db [:chats chat-id] merge chat))))
|
||||
|
|
|
@ -211,8 +211,8 @@
|
|||
:keypair {:public public-key
|
||||
:private private-key})))
|
||||
(protocol/send-message! (assoc-in options
|
||||
[:message :to] (:to message))))
|
||||
(dispatch [:inc-clock chat-id]))))))
|
||||
[:message :to] (:to message))))))
|
||||
(dispatch [:inc-clock chat-id]))))
|
||||
|
||||
(register-handler ::send-command-protocol!
|
||||
(u/side-effect!
|
||||
|
@ -226,14 +226,14 @@
|
|||
:timestamp (datetime/now-ms)
|
||||
:clock-value clock-value}
|
||||
options {:web3 web3
|
||||
:message {:from current-public-key
|
||||
:message-id message-id
|
||||
:payload payload}}]
|
||||
:message {:from current-public-key
|
||||
:message-id message-id
|
||||
:payload payload}}]
|
||||
(if group-chat
|
||||
(protocol/send-group-message! (assoc options
|
||||
:group-id chat-id
|
||||
:keypair {:public public-key
|
||||
:private private-key}))
|
||||
(protocol/send-message! (assoc-in options
|
||||
[:message :to] chat-id)))
|
||||
(dispatch [:inc-clock chat-id])))))))
|
||||
[:message :to] chat-id)))))
|
||||
(dispatch [:inc-clock chat-id])))))
|
||||
|
|
Loading…
Reference in New Issue