Skip to content

Commit a381d99

Browse files
committed
Missing changes to last commit
1 parent 4055a91 commit a381d99

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/finecode/wm_server/context.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import asyncio
34
from dataclasses import dataclass, field
45
from pathlib import Path
56
from typing import TYPE_CHECKING, Any
@@ -51,6 +52,17 @@ class WorkspaceContext:
5152
ws_action_schemas: dict[Path, dict[str, dict | None]] = field(default_factory=dict)
5253
wal_writer: WalWriter | None = None
5354

55+
# Serializes the fast discovery phase of workspace mutations (addDir, removeDir,
56+
# startRunners): dir-list updates, filesystem scan, and projects_to_init
57+
# computation. Released before the slow runner-startup phase begins.
58+
workspace_state_lock: asyncio.Lock = field(default_factory=asyncio.Lock)
59+
60+
# Per-project initialization locks. Guard the slow per-project work: config
61+
# reading, preset resolution, and runner startup. Created once per project path
62+
# inside workspace_state_lock so they are always present before being awaited.
63+
# A locked entry means initialization is in progress for that project.
64+
project_init_locks: dict[Path, asyncio.Lock] = field(default_factory=dict)
65+
5466

5567
@dataclass
5668
class CachedAction:

0 commit comments

Comments
 (0)