-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from pluginpal/feature/prevent-deadlock
fix: prevent deadlocks from happening by using the native deleteMany …
- Loading branch information
Showing
3 changed files
with
8 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pluginpal/webtools-core": patch | ||
--- | ||
|
||
Prevent deadlocks from happening by using the native deleteMany service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
import { factories } from '@strapi/strapi'; | ||
import { EntityService, Common } from '@strapi/types'; | ||
|
||
/** | ||
* URL alias service | ||
*/ | ||
|
||
const contentTypeSlug = 'plugin::webtools.url-alias'; | ||
|
||
export default factories.createCoreService(contentTypeSlug, ({ strapi }) => ({ | ||
deleteMany: async (params: EntityService.Params.Pick<Common.UID.ContentType, 'filters'>) => { | ||
const toBeDeletedEntities = await strapi.entityService.findMany(contentTypeSlug, params); | ||
|
||
await Promise.all(toBeDeletedEntities.map(async (entity) => { | ||
await strapi.entityService.delete(contentTypeSlug, entity.id); | ||
})); | ||
|
||
return true; | ||
}, | ||
})); | ||
export default factories.createCoreService(contentTypeSlug); |