forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sandbox: Manage resources and close them properly on failure. (digita…
…l-asset#3871) * sandbox: Create a monadic `ResourceOwner` to manage resources. * sandbox: Rewrite `ResourceOwner` to be async. * sandbox: Make sure failed resources are closed immediately. * sandbox: Better naming in `Open`. * sandbox: Rename `Open` to `Resource`, and open/close to acquire/release. * sandbox: Convert `() => AutoCloseable` into `ResourceOwner`. * sandbox: Refactor the LedgerApiServer in terms of resources. * sandbox: Explicitly convert `() => AutoCloseable` to `ResourceOwner`. Explicit > Implicit, right? * sandbox: Create helpers for converting things to ResourceOwners. Because I tried to start using them and there was so much code being written at once. * sandbox: Simplify construction of JdbcLedgerDao. * sandbox: Releasing resources should be idempotent. In that we should only do it once. * sandbox: Fix the ResetService by closing the API services _first_. They need to be shut down before the gRPC server. * sandbox: Don't try and shut down PostgreSQL twice in tests. * sandbox: Actually run the assertions in ResourceOwnerSpec. Facepalm. * sandbox: Test `Resource.sequence` more rigorously. * sandbox: Move the helpers around `Resource` into `Resource.apply`. * sandbox: Convert LedgerApiServer resource owners to classes. * sandbox: Make `ResourceOwner` a monad too, delegating to `Resource`. * sandbox: Turn `LedgerApiServer` into a ResourceOwner. * sandbox: Simplify the public signature of `Resource.apply`. * sandbox: Use ResourceOwners to simplify DB resource management. This is one hell of a change. Sorry. * sandbox: Try not to nest `Await.result` calls. Causes issues when running in a `DirectExecutionContext`. * sandbox: Turn index subscriptions into resources. * sandbox: Fix warnings in RecoveringIndexerSpec. * sandbox: Always release before recovering the indexer. * sandbox: Add `flatten` and `transformWith` to `Resource`. * sandbox: If releasing twice in parallel, the second should wait. * sandbox: If the indexer recovers, clean up the old subscription. * sandbox: Convert StandaloneIndexerServer into a resource owner. * sandbox: Convert StandaloneApiServer into a resource owner. * reference-v2: Rewrite ReferenceServer in terms of resources. CHANGELOG_BEGIN - [Reference v2] On an exception, shut down everything and crash. Previously, the server would stay in a half-running state. CHANGELOG_END * sandbox: Rewrite SandboxServer in terms of resources. * sandbox: Write the port file in a Future. * sandbox: JdbcIndexer no longer needs to manage the actorSystem. * sandbox: Shut down the LedgerApiServer when closing the Sandbox. * sandbox: Rename `Resource.pure` to `Resource.successful`. * sandbox: Rename `Resource.sequence_` to `sequenceIgnoringValues`. * sandbox: Delete `CloseableResource`. It's only used in once place. Just inline it. * sandbox: `LedgerDao` no longer needs to be closeable. * sandbox: Delete implicit materializers where they're not used. * http-json: Wait for the Sandbox to start in tests. * sandbox: Convert `scheduleHeartbeats` into a ResourceOwner. * reference-v2: Explain why we steal ownership of the actor system. * sandbox: Document why we only release resources once. * sandbox: Add clues to ResourceOwnerSpec. * http-json: Fix HttpServiceTestFixture to pass auth service through. * codegen-sample-app: In ScalaCodeGenIT, wait for the server to start.
- Loading branch information
1 parent
b72dbb9
commit 1794d8a
Showing
47 changed files
with
2,058 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.