File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed
Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -241,23 +241,34 @@ export async function createDeployment(): Promise<DeploymentInstance> {
241241 . toString ( 36 )
242242 . substring ( 2 , 9 ) } `;
243243
244- // Register automatic cleanup
244+ // Register automatic cleanup (non-blocking for deployments)
245245 registerCleanupTask ( {
246246 id : deploymentId ,
247247 type : "deployment" ,
248248 cleanup : async ( ) => {
249- if ( isRelatedToTest ( deployResult . workerName , resourceUniqueKey ) ) {
250- await deleteWorker (
251- deployResult . workerName ,
249+ // Run deployment cleanup in background without blocking
250+ const performCleanup = async ( ) => {
251+ if ( isRelatedToTest ( deployResult . workerName , resourceUniqueKey ) ) {
252+ await deleteWorker (
253+ deployResult . workerName ,
254+ env . projectDir ,
255+ resourceUniqueKey ,
256+ ) ;
257+ }
258+ await deleteD1Database (
259+ resourceUniqueKey ,
252260 env . projectDir ,
253261 resourceUniqueKey ,
254262 ) ;
255- }
256- await deleteD1Database (
257- resourceUniqueKey ,
258- env . projectDir ,
259- resourceUniqueKey ,
260- ) ;
263+ } ;
264+
265+ // Start cleanup in background and return immediately
266+ performCleanup ( ) . catch ( ( error ) => {
267+ console . warn (
268+ `Warning: Background deployment cleanup failed: ${ ( error as Error ) . message } ` ,
269+ ) ;
270+ } ) ;
271+ return Promise . resolve ( ) ;
261272 } ,
262273 } ) ;
263274
You can’t perform that action at this time.
0 commit comments