( options: WorkspaceFilesystemLifecycleOptions, )
| 128 | } |
| 129 | |
| 130 | function resolveOptions( |
| 131 | options: WorkspaceFilesystemLifecycleOptions, |
| 132 | ): ResolvedWorkspaceFilesystemLifecycleOptions { |
| 133 | const workspaceKey = resolveWorkspaceKey(options); |
| 134 | const layout = options.logDir ? null : getWorkspaceFilesystemLayout(workspaceKey); |
| 135 | const logDir = options.logDir ?? layout?.logs; |
| 136 | if (!logDir) { |
| 137 | throw new Error('Workspace filesystem lifecycle requires a log directory'); |
| 138 | } |
| 139 | |
| 140 | return { |
| 141 | workspaceKey, |
| 142 | trigger: options.trigger, |
| 143 | logDir, |
| 144 | markerPath: |
| 145 | options.markerPath ?? |
| 146 | layout?.filesystemLifecycle.markerPath ?? |
| 147 | path.join(logDir, FALLBACK_MARKER_FILE), |
| 148 | lockDir: |
| 149 | options.lockDir ?? |
| 150 | layout?.filesystemLifecycle.lockDir ?? |
| 151 | path.join(logDir, FALLBACK_LOCK_DIR_NAME), |
| 152 | resultBundleDir: layout?.resultBundles ?? null, |
| 153 | now: options.now ?? Date.now(), |
| 154 | maxAgeMs: options.maxAgeMs ?? WORKSPACE_FILESYSTEM_LIFECYCLE_LOG_MAX_AGE_MS, |
| 155 | maxFiles: options.maxFiles ?? WORKSPACE_FILESYSTEM_LIFECYCLE_LOG_MAX_FILES, |
| 156 | cooldownMs: options.cooldownMs ?? WORKSPACE_FILESYSTEM_LIFECYCLE_COOLDOWN_MS, |
| 157 | force: options.force ?? false, |
| 158 | minVisibleMs: options.minVisibleMs ?? WORKSPACE_FILESYSTEM_LIFECYCLE_MIN_VISIBLE_MS, |
| 159 | protectedLogPaths: options.protectedLogPaths ?? [], |
| 160 | timeoutMs: options.timeoutMs ?? 1000, |
| 161 | lockPurpose: options.lockPurpose ?? 'filesystem-lifecycle', |
| 162 | daemonCleanup: options.daemonCleanup, |
| 163 | }; |
| 164 | } |
| 165 | |
| 166 | async function shouldSkipForCooldown( |
| 167 | markerPath: string, |
no test coverage detected