@yanzhang123/readonly-db-mcp 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/npm/lib/launcher.cjs
CHANGED
|
@@ -147,8 +147,11 @@ function sleep(milliseconds) {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
// Returns null when another process finished an installation that matches
|
|
151
|
+
// this package. A stale marker alone is not enough: the lock holder may be
|
|
152
|
+
// replacing that runtime right now.
|
|
153
|
+
function acquireInstallLock(lockPath, isReady, { timeoutMs = 180_000 } = {}) {
|
|
154
|
+
const deadline = Date.now() + timeoutMs;
|
|
152
155
|
while (true) {
|
|
153
156
|
try {
|
|
154
157
|
return fs.openSync(lockPath, "wx");
|
|
@@ -156,7 +159,7 @@ function acquireInstallLock(lockPath, markerPath) {
|
|
|
156
159
|
if (!error || error.code !== "EEXIST") {
|
|
157
160
|
throw error;
|
|
158
161
|
}
|
|
159
|
-
if (
|
|
162
|
+
if (isReady()) {
|
|
160
163
|
return null;
|
|
161
164
|
}
|
|
162
165
|
const age = Date.now() - fs.statSync(lockPath).mtimeMs;
|
|
@@ -187,7 +190,9 @@ function ensureRuntime() {
|
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
fs.mkdirSync(runtimeRoot, { recursive: true });
|
|
190
|
-
const lockHandle = acquireInstallLock(lock,
|
|
193
|
+
const lockHandle = acquireInstallLock(lock, () =>
|
|
194
|
+
runtimeIsReady(marker, runtimePython, fingerprint),
|
|
195
|
+
);
|
|
191
196
|
if (lockHandle === null) {
|
|
192
197
|
return runtimePython;
|
|
193
198
|
}
|
|
@@ -284,6 +289,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
module.exports = {
|
|
292
|
+
acquireInstallLock,
|
|
287
293
|
bundledWheel,
|
|
288
294
|
cacheBase,
|
|
289
295
|
dependencyLock,
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|