Skip to content

Commit

Permalink
add a hard delete on memberships to fix stuck workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Dec 10, 2024
1 parent e55b115 commit 4535dde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions front/lib/resources/membership_resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@ export class MembershipResource extends BaseResource<MembershipModel> {
});
}

static async deleteAllForWorkspace(
workspace: LightWorkspaceType,
transaction?: Transaction
) {
return this.model.destroy({
where: { workspaceId: workspace.id },
transaction,
});
}

/**
* Caller of this method should call `ServerSideTracking.trackCreateMembership`.
*/
Expand Down
1 change: 1 addition & 0 deletions front/poke/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ export async function deleteWorkspaceActivity({
});
await FileResource.deleteAllForWorkspace(workspace, t);
await RunResource.deleteAllForWorkspace(workspace, t);
await MembershipResource.deleteAllForWorkspace(workspace, t);
await AgentUserRelation.destroy({
where: { workspaceId: workspace.id },
transaction: t,
Expand Down

0 comments on commit 4535dde

Please sign in to comment.