Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ function portConflictSuggestion(hostPort: string, serviceLabel: string): string
* Creates the shared docker network for this project via `docker network create --label ...`,
* treating "already exists" as success.
*
* Called once per `start` run rather than once per container: the network can't be deleted
* externally mid-run, so it's guaranteed to still exist for every later {@link createContainer}
* call. Returns immediately for a built-in network name (`default`, `bridge`, `host`, `none`),
* which already exists and cannot be created.
* Called once per `start` run rather than once per container: callers holding the project lifecycle
* lock keep other lifecycle commands from pruning it before every {@link createContainer} call has run.
* Returns immediately for a built-in network name (`default`, `bridge`, `host`, `none`), which
* already exists and cannot be created.
*/
export function ensureNetwork(
spawner: Spawner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { goUrlParse } from "../storage-url.ts";
import { loadLocalProjectContext } from "../local-project-context.ts";
import { cliProjectFilterValue, localDbContainerId } from "../docker-ids.ts";
import { isBitbucketPipeline } from "../bitbucket-pipeline.ts";
import { holdLocalStackStartLock } from "../local-stack-start-lock.ts";
import { holdProjectLifecycleLock } from "../project-lifecycle-lock.ts";
import { dbNotRunningError } from "../status-errors.ts";
import { buildLocalDbContainerInputs } from "./local-container-inputs.ts";
import { removeContainer } from "./container-lifecycle.ts";
Expand Down Expand Up @@ -89,6 +89,7 @@ interface StartLocalDatabaseResult {
readonly status: StartLocalDatabaseStatus;
}

/** Takes the project lifecycle lock into its scope; {@link startLocalDatabase} closes that scope after rollback. */
const startLocalDatabaseInScope = Effect.fn("DbBootstrap.startLocalDatabase")(function* (
fromBackupFlag?: string,
) {
Expand Down Expand Up @@ -631,8 +632,8 @@ const startLocalDatabaseInScope = Effect.fn("DbBootstrap.startLocalDatabase")(fu
),
);

// Held through bring-up and rollback so a concurrent start cannot prune this run's containers.
yield* holdLocalStackStartLock(context.projectId);
// Held until this call returns, after any rollback has run.
yield* holdProjectLifecycleLock(context.projectId);

// If the db container is already up, tell the caller and stop here. Runs after the config
// load/validation above.
Expand Down
89 changes: 0 additions & 89 deletions apps/cli/src/command-internal/local-stack-start-lock.ts

This file was deleted.

Loading
Loading