File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
components/server/src/workspace Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1435,14 +1435,17 @@ export class WorkspaceStarter {
1435
1435
}
1436
1436
}
1437
1437
1438
- const volumeSnapshotId =
1439
- ( SnapshotContext . is ( workspace . context ) || WithPrebuild . is ( workspace . context ) ) &&
1440
- ! ! workspace . context . snapshotBucketId
1441
- ? workspace . context . snapshotBucketId
1442
- : lastValidWorkspaceInstanceId ;
1438
+ let volumeSnapshotId = ""
1439
+ // always pick lastValidWorkspaceInstanceId if it is valid, otherwise workspace will be restored from prebuild
1440
+ // even if there was workspace backup available
1441
+ if ( lastValidWorkspaceInstanceId != "" ) {
1442
+ volumeSnapshotId = lastValidWorkspaceInstanceId
1443
+ } else if ( ( SnapshotContext . is ( workspace . context ) || WithPrebuild . is ( workspace . context ) ) && ! ! workspace . context . snapshotBucketId ) {
1444
+ volumeSnapshotId = workspace . context . snapshotBucketId
1445
+ }
1443
1446
1444
1447
let volumeSnapshotInfo = new VolumeSnapshotInfo ( ) ;
1445
- const volumeSnapshots = await this . workspaceDb . trace ( traceCtx ) . findVolumeSnapshotById ( volumeSnapshotId ) ;
1448
+ const volumeSnapshots = volumeSnapshotId != "" ? await this . workspaceDb . trace ( traceCtx ) . findVolumeSnapshotById ( volumeSnapshotId ) : undefined ;
1446
1449
if ( volumeSnapshots !== undefined ) {
1447
1450
log . info ( "starting workspace with volume snapshot info" , {
1448
1451
lastInstanceId : lastValidWorkspaceInstanceId ,
You can’t perform that action at this time.
0 commit comments