Coordinate workspace cleanup with active operations
This commit is contained in:
@@ -64,23 +64,22 @@ func withLockedInvocation(ctx context.Context, cfg *config.Config, plan BoundedP
|
||||
if _, _, err := loadManifestAtPathIfPresent(ctx, &manifest.LocalStore{}, runtime.manifestPath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := prepareInvocationLayout(runtime); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lock, err := runtime.artifactStore.AcquireWorkspaceLockContext(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("acquire session lock: %w", err)
|
||||
return nil, fmt.Errorf("acquire workspace lock: %w", err)
|
||||
}
|
||||
defer func() {
|
||||
if releaseErr := runtime.artifactStore.ReleaseWorkspaceLock(lock); releaseErr != nil {
|
||||
if resultErr == nil {
|
||||
resultErr = fmt.Errorf("release session lock: %w", releaseErr)
|
||||
resultErr = fmt.Errorf("release workspace lock: %w", releaseErr)
|
||||
} else {
|
||||
resultErr = errors.Join(resultErr, fmt.Errorf("release session lock: %w", releaseErr))
|
||||
resultErr = errors.Join(resultErr, fmt.Errorf("release workspace lock: %w", releaseErr))
|
||||
}
|
||||
}
|
||||
}()
|
||||
if err := prepareInvocationLayout(runtime); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
if runtime.started {
|
||||
result, resultErr = finalizeInvocation(runtime, resultErr)
|
||||
|
||||
Reference in New Issue
Block a user