@@ -6,6 +6,7 @@ import { DeleteProjectService } from "./deleteProject.server";
66import { getCurrentPlan } from "./platform.v3.server" ;
77import { controlPlaneResolver } from "~/v3/runOpsMigration/controlPlaneResolver.server" ;
88import { commonWorker } from "~/v3/commonWorker.server" ;
9+ import { logger } from "./logger.server" ;
910
1011export class DeleteOrganizationService {
1112 #prismaClient: PrismaClient ;
@@ -90,10 +91,18 @@ export class DeleteOrganizationService {
9091
9192 // Soft-delete the org's dashboard agent chats; retention purges them later. Enqueued,
9293 // not inline: the agent store is a separate database in cloud.
93- await commonWorker . enqueue ( {
94- id : `dashboardAgent.purgeOrganization:${ organization . id } ` ,
95- job : "dashboardAgent.purgeOrganization" ,
96- payload : { organizationId : organization . id } ,
97- } ) ;
94+ // Best-effort: a failed enqueue must not fail org deletion (the org is already deleted).
95+ try {
96+ await commonWorker . enqueue ( {
97+ id : `dashboardAgent.purgeOrganization:${ organization . id } ` ,
98+ job : "dashboardAgent.purgeOrganization" ,
99+ payload : { organizationId : organization . id } ,
100+ } ) ;
101+ } catch ( error ) {
102+ logger . warn ( "Failed to enqueue dashboard agent purge for deleted organization" , {
103+ organizationId : organization . id ,
104+ error,
105+ } ) ;
106+ }
98107 }
99108}
0 commit comments