mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 08:15:50 +00:00
fix(plugin-data-source-main): fix lock usage
This commit is contained in:
parent
2251742b86
commit
15593b5185
@ -316,7 +316,7 @@ export class PluginDataSourceMainServer extends Plugin {
|
|||||||
this.app.db.on('fields.beforeDestroy', beforeDestroyForeignKey(this.app.db));
|
this.app.db.on('fields.beforeDestroy', beforeDestroyForeignKey(this.app.db));
|
||||||
|
|
||||||
this.app.db.on('fields.beforeDestroy', async (model: FieldModel, options) => {
|
this.app.db.on('fields.beforeDestroy', async (model: FieldModel, options) => {
|
||||||
const lockKey = `${this.name}:fields.beforeDestroy:${model.get('collectionName')}:${model.get('name')}`;
|
const lockKey = `${this.name}:fields.beforeDestroy:${model.get('collectionName')}`;
|
||||||
await this.app.lockManager.runExclusive(lockKey, async () => {
|
await this.app.lockManager.runExclusive(lockKey, async () => {
|
||||||
await model.remove(options);
|
await model.remove(options);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user