Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Conversation

@mikeseese
Copy link
Contributor

This PR was driven by having an issue incorporating Ganache v7 into Ganache UI. If there was an error before the Server.status was set to opening, but the constructors started async operations (i.e. opening the database), then things would get locked without the ability to be closed properly during Server.close()

So this PR does a couple of things:

  • Provide more/rearchitect the server Status enum to be more accurate and appropriate
  • Move all asynchronous code from constructors to a dedicated asynchronous initialize functions so that we can guarantee that we can appropriately close things when things fail
  • Coincidentally, this has caused Ganache.provider() to become asynchronous by nature. It always "was" and the work around was to use an event emitter to say when things were ready. This may get modified to go back to the old way (while still keeping the other benefits added in this PR) to maintain back-compatibility. However that decision is still waiting on feedback from the rest of the team. This PR won't get merged until the final direction has been decided and implemented in this PR. In the meantime, the other parts can be reviewed.

@mikeseese mikeseese requested a review from davidmurdoch March 18, 2021 01:12
@mikeseese mikeseese changed the title fix: rearhictecture server status and move async functions from constructors to initialize functions fix: rearchitecture server status and move async functions from constructors to initialize functions Mar 18, 2021
@mikeseese mikeseese requested a review from davidmurdoch March 29, 2021 23:53
@mikeseese mikeseese requested a review from davidmurdoch March 30, 2021 18:21
@mikeseese mikeseese requested a review from davidmurdoch March 30, 2021 18:58
@mikeseese mikeseese changed the title fix: rearchitecture server status and move async functions from constructors to initialize functions fix: rearchitect server status and move async functions from constructors to initialize functions Mar 30, 2021
@mikeseese mikeseese merged commit 85bb1fe into develop Mar 30, 2021
@mikeseese mikeseese deleted the fix/server-and-initialization-rearchitecture branch March 30, 2021 21:14
mikeseese added a commit that referenced this pull request Mar 30, 2021
…nc-init

implement #877 async init changes for the filecoin flavor
sambacha pushed a commit to contractshark/ganache-core that referenced this pull request Apr 14, 2021
* chore: point community link at our discord channel (ConsenSys-archive#874)

* chore(deps): bump y18n from 4.0.0 to 4.0.1 (ConsenSys-archive#884)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: rearchitect server status and move async functions from constructors to initialize functions (ConsenSys-archive#877)

* feat: add filecoin flavor (ConsenSys-archive#888)

Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: Tim Coulter <[email protected]>

* fix: support a uws fallback if uws native binaries don't exist (win+electron) (ConsenSys-archive#893)

Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Seese <[email protected]>
Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: Tim Coulter <[email protected]>
sambacha pushed a commit to contractshark/ganache-core that referenced this pull request Apr 15, 2021
* chore: point community link at our discord channel (ConsenSys-archive#874)

* chore(deps): bump y18n from 4.0.0 to 4.0.1 (ConsenSys-archive#884)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: rearchitect server status and move async functions from constructors to initialize functions (ConsenSys-archive#877)

* feat: add filecoin flavor (ConsenSys-archive#888)

Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: Tim Coulter <[email protected]>

* fix: support a uws fallback if uws native binaries don't exist (win+electron) (ConsenSys-archive#893)

Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Seese <[email protected]>
Co-authored-by: David Murdoch <[email protected]>
Co-authored-by: Tim Coulter <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants