@@ -26,32 +26,26 @@ import {
2626 StartSandboxOpts ,
2727} from "./types" ;
2828import { PitcherManagerResponse } from "@codesandbox/pitcher-client" ;
29- import { sleep } from "./utils/sleep" ;
3029
3130export async function startVm (
3231 apiClient : Client ,
3332 sandboxId : string ,
3433 startOpts ?: StartSandboxOpts
3534) : Promise < PitcherManagerResponse > {
36- const startResult = await retryWithDelay (
37- ( ) =>
38- vmStart ( {
39- client : apiClient ,
40- body : startOpts
41- ? {
42- ipcountry : startOpts . ipcountry ,
43- tier : startOpts . vmTier ?. name ,
44- hibernation_timeout_seconds : startOpts . hibernationTimeoutSeconds ,
45- automatic_wakeup_config : startOpts . automaticWakeupConfig ,
46- }
47- : undefined ,
48- path : {
49- id : sandboxId ,
50- } ,
51- } ) ,
52- 3 ,
53- 200
54- ) ;
35+ const startResult = await vmStart ( {
36+ client : apiClient ,
37+ body : startOpts
38+ ? {
39+ ipcountry : startOpts . ipcountry ,
40+ tier : startOpts . vmTier ?. name ,
41+ hibernation_timeout_seconds : startOpts . hibernationTimeoutSeconds ,
42+ automatic_wakeup_config : startOpts . automaticWakeupConfig ,
43+ }
44+ : undefined ,
45+ path : {
46+ id : sandboxId ,
47+ } ,
48+ } ) ;
5549
5650 const response = handleResponse (
5751 startResult ,
@@ -120,7 +114,11 @@ export class Sandboxes {
120114 * Note! On CLEAN bootups the setup will run again. When hibernated a new snapshot will be created.
121115 */
122116 async resume ( sandboxId : string ) {
123- const startResponse = await startVm ( this . apiClient , sandboxId ) ;
117+ const startResponse = await retryWithDelay (
118+ ( ) => startVm ( this . apiClient , sandboxId ) ,
119+ 3 ,
120+ 200
121+ ) ;
124122 return new Sandbox ( sandboxId , this . apiClient , startResponse ) ;
125123 }
126124
0 commit comments