nwc: remove requests from postbox
Since these are ephemeral events, there will never be command results, so we need to remove them manually on NWC responses or else it will keep trying to send them. We should probably handle this for all ephemeral events in the postbox somehow. We probably shouldn't use the postbox for ephemeral events without response events.
This commit is contained in:
@@ -145,6 +145,14 @@ class HomeModel: ObservableObject {
|
||||
return
|
||||
}
|
||||
|
||||
// since command results are not returned for ephemeral events,
|
||||
// remove the request from the postbox which is likely failing over and over
|
||||
if damus_state.postbox.remove_relayer(relay_id: nwc.relay.id, event_id: resp.req_id) {
|
||||
print("nwc: got response, removed \(resp.req_id) from the postbox")
|
||||
} else {
|
||||
print("nwc: \(resp.req_id) not found in the postbox, nothing to remove")
|
||||
}
|
||||
|
||||
if resp.response.error == nil {
|
||||
nwc_success(zapcache: self.damus_state.zaps, evcache: self.damus_state.events, resp: resp)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user