fix: add EOSE timeout fallback and increase handle_missed_events default#48
Closed
dadofsambonzuki wants to merge 1 commit into
Closed
fix: add EOSE timeout fallback and increase handle_missed_events default#48dadofsambonzuki wants to merge 1 commit into
dadofsambonzuki wants to merge 1 commit into
Conversation
- Add 10s EOSE timeout guard to prevent the provider from hanging indefinitely if EOSE is never received or lost in transit - Process all queued events after timeout and mark subscriptions ready for real-time processing - Increase handle_missed_events default from 0 to 120s to recover missed requests on reconnect
Author
|
Running on my local instance with multiple wallets showing no connection issues now. |
Author
|
Closing this PR — the root cause was a thread-safety race condition in the nostrclient extension router, fixed upstream in lnbits/nostrclient#71 The NWC provider was fine; the events/EOSE it needed were being silently dropped by the nostrclient relay due to unsynchronized access to shared ClassVar state between a daemon thread and asyncio tasks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The NWC Service Provider blocks ALL request processing until it receives EOSE (End of Stored Events) for both its subscriptions (kind 23194 and 23195). If EOSE is never received — which can happen if:
...the provider silently queues incoming request events but never processes them. Client wallets see "all promises rejected" because their NWC calls time out with no response.
Additionally,
handle_missed_eventsdefaults to0, meaning on reconnect the provider only subscribes to events created after reconnection. Any requests sent during the disconnect window are permanently lost.Changes
1.
nwcp.py— EOSE timeout fallback_eose_timeoutmethod: a 10-second guard that fires if both EOSEs have not arrivedTrue, processes all queued stale events, and allows future events to be processed in real-time_process_stale_eventshelper for reuse2.
nwcp.py— Cleanupeose_timeout_taskcancellation incleanup()and_subscribe()3.
migrations.pyhandle_missed_eventsfrom0to1204.
README.mdTesting
Verified that: