Implement timestamp-based network subscription optimization
Changelog-Changed: Optimized network bandwidth usage and improved timeline performance Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -35,6 +35,15 @@ enum NostrConnectionEvent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var subId: String? {
|
||||
switch self {
|
||||
case .ws_connection_event(_):
|
||||
return nil
|
||||
case .nostr_event(let event):
|
||||
return event.subid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class RelayConnection: ObservableObject {
|
||||
|
||||
@@ -535,6 +535,8 @@ actor RelayPool {
|
||||
}
|
||||
|
||||
for handler in handlers {
|
||||
guard handler.sub_id == event.subId else { continue }
|
||||
logStreamPipelineStats("RelayPool_\(relay_id.absoluteString)", "RelayPool_Handler_\(handler.sub_id)")
|
||||
handler.handler.yield((relay_id, event))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user