Improve NostrNetworkManager interfaces
This commit improves NostrNetworkManager interfaces to be easier to use, and with more options on how to read data from the Nostr network This reduces the amount of duplicate logic in handling streams, and also prevents possible common mistakes when using the standard subscribe method. This fixes an issue with the mute list manager (which prompted for this interface improvement, as the root cause is similar to other similar issues). Closes: https://github.com/damus-io/damus/issues/3221 Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -47,8 +47,8 @@ class NostrNetworkManagerTests: XCTestCase {
|
||||
Task {
|
||||
for await item in self.damusState!.nostrNetwork.reader.subscribe(filters: [filter]) {
|
||||
switch item {
|
||||
case .event(borrow: let borrow):
|
||||
try? borrow { event in
|
||||
case .event(let lender):
|
||||
try? lender.borrow { event in
|
||||
receivedCount += 1
|
||||
if eventIds.contains(event.id) {
|
||||
XCTFail("Got duplicate event ID: \(event.id) ")
|
||||
|
||||
Reference in New Issue
Block a user