Sync DNS2 production changes - removed obsolete test suite and refactored structure
This commit is contained in:
@@ -16,10 +16,10 @@ const LOCK_RETRY_OPTIONS = {
|
||||
retries: 10,
|
||||
minTimeout: 100,
|
||||
maxTimeout: 1000,
|
||||
randomize: true,
|
||||
randomize: true
|
||||
},
|
||||
stale: LOCK_STALE_THRESHOLD,
|
||||
realpath: false,
|
||||
realpath: false
|
||||
};
|
||||
|
||||
class PortLockManager {
|
||||
@@ -72,7 +72,7 @@ class PortLockManager {
|
||||
if (!fs.existsSync(lockFilePath)) {
|
||||
fs.writeFileSync(lockFilePath, JSON.stringify({
|
||||
created: new Date().toISOString(),
|
||||
port,
|
||||
port
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class PortLockManager {
|
||||
this.activeLocks.set(lockId, {
|
||||
ports: sortedPorts,
|
||||
releases: releaseFunctions,
|
||||
timestamp: Date.now(),
|
||||
timestamp: Date.now()
|
||||
});
|
||||
|
||||
console.log(`[PortLockManager] Successfully acquired all locks (ID: ${lockId})`);
|
||||
@@ -97,13 +97,13 @@ class PortLockManager {
|
||||
|
||||
} catch (error) {
|
||||
// Release any locks we managed to acquire
|
||||
console.error('[PortLockManager] Failed to acquire all locks:', error.message);
|
||||
console.error(`[PortLockManager] Failed to acquire all locks:`, error.message);
|
||||
|
||||
for (const release of releaseFunctions) {
|
||||
try {
|
||||
await release();
|
||||
} catch (releaseError) {
|
||||
console.error('[PortLockManager] Error releasing lock during cleanup:', releaseError.message);
|
||||
console.error(`[PortLockManager] Error releasing lock during cleanup:`, releaseError.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class PortLockManager {
|
||||
await release();
|
||||
} catch (error) {
|
||||
errors.push(error.message);
|
||||
console.error('[PortLockManager] Error releasing lock:', error.message);
|
||||
console.error(`[PortLockManager] Error releasing lock:`, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,13 +198,13 @@ class PortLockManager {
|
||||
lockId,
|
||||
ports: info.ports,
|
||||
age: Date.now() - info.timestamp,
|
||||
timestamp: new Date(info.timestamp).toISOString(),
|
||||
timestamp: new Date(info.timestamp).toISOString()
|
||||
}));
|
||||
|
||||
return {
|
||||
activeLocks: activeLocks.length,
|
||||
locks: activeLocks,
|
||||
lockDirectory: LOCK_DIR,
|
||||
lockDirectory: LOCK_DIR
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user