-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api-headless-cms-bulk-actions): empty trash bin processing entries in series #4351
base: dev
Are you sure you want to change the base?
Conversation
# Conflicts: # packages/api-headless-cms-bulk-actions/src/tasks/createEmptyTrashBinsTask.ts # packages/api-headless-cms-bulk-actions/src/types.ts
@@ -10,7 +10,10 @@ export interface CreateBulkActionGraphQL { | |||
|
|||
export const createBulkActionGraphQL = (config: CreateBulkActionGraphQL) => { | |||
return new ContextPlugin<HcmsBulkActionsContext>(async context => { | |||
if (!(await isHeadlessCmsReady(context))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isHeadlessCmsReady()
already has checks for tenant
and locale
.
const tenant = context.tenancy.getCurrentTenant(); | ||
const locale = context.i18n.getContentLocale(); | ||
|
||
if (!tenant || !locale || !(await isHeadlessCmsReady(context))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as in createBulkActionGraphQL
file.
return; | ||
} | ||
|
||
const plugin = new CmsGraphQLSchemaPlugin<Context>({ | ||
typeDefs: createTypeDefs(models as NonEmptyArray<CmsModel>), | ||
resolvers: createResolvers(models as NonEmptyArray<CmsModel>) | ||
resolvers: createResolvers(models as NonEmptyArray<CmsModel>), | ||
isApplicable: context => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont understand this check. You get tenant on line 10 and then you get it here again, with same method. Isn't it the same?
Changes
This PR addresses a bug that arose when emptying the trash bin for instances with many tenants.
Previously, the deletion process operated in parallel. Each tenant, locale, or model triggered a subtask to delete all eligible entries in the specific model for removal. This approach caused errors when dealing with instances that had multiple tenants.
With this update, we consolidate the deletion into a single task that iterates through all tenants, locales, and models, deleting the eligible entries in series.
How Has This Been Tested?
Manually