-
Notifications
You must be signed in to change notification settings - Fork 678
fix: after provider.disconnect()
is called, Ganache should stop serving requests
#3433
Conversation
…r.disconnect() is called.
provider.disconnect()
is called, Ganache should stop serving requestsprovider.disconnect()
is called, Ganache should stop serving requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jeffsmale90. I spent a moment to marvel at the fix and left some minor nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff!
3d555b9
to
2b464fd
Compare
2b464fd
to
c0bd2f8
Compare
I've narrowed the scope of this PR as suggested by @davidmurdoch. It now just stops processing requests, and rejects pending tasks. It makes a "best effort" attempt to resolve in order, but will fail in most cases, because we do not wait for inflight requests to resolve before shutting down the blockchain. See #3499 to cover those changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question and a comment for you!
…ConnectorLoader to _not_ maintain a reference to requestCoordinator.resume(), and test obscure edge case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐⭐⭐⭐⭐
Would review again!
Previously, when
provider.disconnect()
was called, a lot of the internals of Ganache would be stopped, but just enough was kept alive to serve requests. This could stop consumers from shutting down cleanly.Now all pending requests, and any new requests will be rejected with a helpful error.
For example, before this change, the following would successfully return the block number:
But now:
Caveat: any request that has started to process, but not yet complete, may fail with an unexpected error. See #3499 for details.
Fixes #3293