use clock
This commit is contained in:
parent
88cda7f786
commit
f256546d10
|
@ -1,11 +1,6 @@
|
||||||
// todo: handle updates together with fetching history (chat messages)
|
|
||||||
// todo: handle diff waku messages on diff topics
|
|
||||||
// todo?: already received (by messageId or event)
|
// todo?: already received (by messageId or event)
|
||||||
// todo: use clock for sorting
|
|
||||||
// todo: use Map
|
// todo: use Map
|
||||||
// todo: write class for channels
|
// todo: write class for channels
|
||||||
// todo: fetch all history until Map; remove end param
|
|
||||||
// todo: handle
|
|
||||||
|
|
||||||
// todo: tests
|
// todo: tests
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,10 @@ export class Community {
|
||||||
communityMetadata: CommunityMetadataType
|
communityMetadata: CommunityMetadataType
|
||||||
) => {
|
) => {
|
||||||
if (this.communityMetadata) {
|
if (this.communityMetadata) {
|
||||||
|
if (this.communityMetadata.clock > communityMetadata.clock) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Channels
|
// Channels
|
||||||
const removedChats = difference(
|
const removedChats = difference(
|
||||||
Object.keys(this.communityMetadata.chats),
|
Object.keys(this.communityMetadata.chats),
|
||||||
|
@ -245,10 +249,7 @@ export class Community {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (_message.clock <= chatMessage.clock) {
|
||||||
new Date(Number(_message.timestamp)) <=
|
|
||||||
new Date(Number(chatMessage.timestamp))
|
|
||||||
) {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue