mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-04 06:53:12 +00:00
fix: filter out ephemeral msg from waku sync (#3332)
This commit is contained in:
parent
7dbc1fe061
commit
cda48e25f7
@ -132,6 +132,9 @@ proc syncMessageIngress*(
|
|||||||
pubsubTopic: PubsubTopic,
|
pubsubTopic: PubsubTopic,
|
||||||
msg: WakuMessage,
|
msg: WakuMessage,
|
||||||
): Future[Result[void, string]] {.async.} =
|
): Future[Result[void, string]] {.async.} =
|
||||||
|
if msg.ephemeral:
|
||||||
|
return err("ephemeral message, will not store")
|
||||||
|
|
||||||
let msgHashHex = msgHash.to0xHex()
|
let msgHashHex = msgHash.to0xHex()
|
||||||
|
|
||||||
trace "handling message in syncMessageIngress",
|
trace "handling message in syncMessageIngress",
|
||||||
|
|||||||
@ -68,6 +68,9 @@ type SyncReconciliation* = ref object of LPProtocol
|
|||||||
proc messageIngress*(
|
proc messageIngress*(
|
||||||
self: SyncReconciliation, pubsubTopic: PubsubTopic, msg: WakuMessage
|
self: SyncReconciliation, pubsubTopic: PubsubTopic, msg: WakuMessage
|
||||||
) =
|
) =
|
||||||
|
if msg.ephemeral:
|
||||||
|
return
|
||||||
|
|
||||||
let msgHash = computeMessageHash(pubsubTopic, msg)
|
let msgHash = computeMessageHash(pubsubTopic, msg)
|
||||||
|
|
||||||
let id = SyncID(time: msg.timestamp, hash: msgHash)
|
let id = SyncID(time: msg.timestamp, hash: msgHash)
|
||||||
@ -78,6 +81,9 @@ proc messageIngress*(
|
|||||||
proc messageIngress*(
|
proc messageIngress*(
|
||||||
self: SyncReconciliation, msgHash: WakuMessageHash, msg: WakuMessage
|
self: SyncReconciliation, msgHash: WakuMessageHash, msg: WakuMessage
|
||||||
) =
|
) =
|
||||||
|
if msg.ephemeral:
|
||||||
|
return
|
||||||
|
|
||||||
let id = SyncID(time: msg.timestamp, hash: msgHash)
|
let id = SyncID(time: msg.timestamp, hash: msgHash)
|
||||||
|
|
||||||
self.storage.insert(id).isOkOr:
|
self.storage.insert(id).isOkOr:
|
||||||
|
|||||||
@ -118,6 +118,10 @@ proc needsReceiverLoop(self: SyncTransfer) {.async.} =
|
|||||||
error "failed to query archive", error = error
|
error "failed to query archive", error = error
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if response.messages.len < 1:
|
||||||
|
error "failed to fetch message from db"
|
||||||
|
continue
|
||||||
|
|
||||||
let msg =
|
let msg =
|
||||||
WakuMessageAndTopic(pubsub: response.topics[0], message: response.messages[0])
|
WakuMessageAndTopic(pubsub: response.topics[0], message: response.messages[0])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user