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

fix: rearchitect server status and move async functions from constructors to initialize functions #877

Merged
merged 13 commits into from
Mar 30, 2021

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 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
src/packages/core/src/server.ts Outdated Show resolved Hide resolved
src/packages/core/src/server.ts Outdated Show resolved Hide resolved
src/packages/core/src/server.ts Outdated Show resolved Hide resolved
src/packages/core/src/server.ts Outdated Show resolved Hide resolved
src/packages/core/src/server.ts Show resolved Hide resolved
src/packages/core/tests/connector.test.ts Outdated Show resolved Hide resolved
src/packages/core/package.json Outdated Show resolved Hide resolved
src/packages/core/package.json Outdated Show resolved Hide resolved
src/packages/core/src/server.ts Outdated Show resolved Hide resolved
@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 (trufflesuite#874)

* chore(deps): bump y18n from 4.0.0 to 4.0.1 (trufflesuite#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 (trufflesuite#877)

* feat: add filecoin flavor (trufflesuite#888)

Co-authored-by: David Murdoch <davidmurdoch@users.noreply.github.com>
Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: Tim Coulter <tim@timothyjcoulter.com>

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

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

* chore(deps): bump y18n from 4.0.0 to 4.0.1 (trufflesuite#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 (trufflesuite#877)

* feat: add filecoin flavor (trufflesuite#888)

Co-authored-by: David Murdoch <davidmurdoch@users.noreply.github.com>
Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: Tim Coulter <tim@timothyjcoulter.com>

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

Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Seese <seesemichaelj@gmail.com>
Co-authored-by: David Murdoch <davidmurdoch@users.noreply.github.com>
Co-authored-by: Tim Coulter <tim@timothyjcoulter.com>
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.

None yet

2 participants