mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 20:56:39 +01:00
Fixes the sending of multiple old events back to the relays that send old events to Amethyst.
This commit is contained in:
@@ -2971,7 +2971,11 @@ object LocalCache : ILocalCache {
|
||||
getAddressableNoteIfExists(event.address())?.let { note ->
|
||||
note.event?.let { existingEvent ->
|
||||
if (existingEvent.createdAt > event.createdAt && !note.hasRelay(relay.url)) {
|
||||
Log.d("LocalCache", "Updating ${relay.url.url} with a new version of ${event.toJson()} to ${existingEvent.toJson()}")
|
||||
Log.d("LocalCache", "Updating ${relay.url.url} with a new version of ${event.kind} ${event.id} to ${existingEvent.id}")
|
||||
|
||||
// only send once.
|
||||
note.addRelay(relay.url)
|
||||
|
||||
relay.send(existingEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ open class Note(
|
||||
}
|
||||
}
|
||||
|
||||
fun hasRelay(relay: NormalizedRelayUrl) = relay !in relays
|
||||
fun hasRelay(relay: NormalizedRelayUrl) = relay in relays
|
||||
|
||||
fun addRelay(relay: NormalizedRelayUrl) {
|
||||
if (relay !in relays) {
|
||||
|
||||
@@ -263,7 +263,7 @@ open class BasicRelayClient(
|
||||
msg: OkMessage,
|
||||
onConnected: () -> Unit,
|
||||
) {
|
||||
// Log.w(logTag, "OK: ${msg.eventId} ${msg.success} ${msg.message}")
|
||||
Log.w(logTag, "OK: ${msg.eventId} ${msg.success} ${msg.message}")
|
||||
|
||||
// if this is the OK of an auth event, renew all subscriptions and resend all outgoing events.
|
||||
if (authResponseWatcher.containsKey(msg.eventId)) {
|
||||
|
||||
Reference in New Issue
Block a user