mirror of
https://github.com/strapi/strapi.git
synced 2025-09-19 21:38:05 +00:00
Merge pull request #15881 from strapi/fix/for-each-async
This commit is contained in:
commit
e2eab7c842
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const { prop, isNil, isEmpty, isArray } = require('lodash/fp');
|
const { prop, isNil, isEmpty, isArray } = require('lodash/fp');
|
||||||
|
|
||||||
const { forEachAsync } = require('@strapi/utils');
|
const { mapAsync } = require('@strapi/utils');
|
||||||
const { getService } = require('../utils');
|
const { getService } = require('../utils');
|
||||||
|
|
||||||
const isDialectMySQL = () => strapi.db.dialect.client === 'mysql';
|
const isDialectMySQL = () => strapi.db.dialect.client === 'mysql';
|
||||||
@ -41,7 +41,7 @@ const syncLocalizations = async (entry, { model }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
|
// MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
|
||||||
await forEachAsync(entry.localizations, (localization) => updateLocalization(localization.id), {
|
await mapAsync(entry.localizations, (localization) => updateLocalization(localization.id), {
|
||||||
concurrency: isDialectMySQL() ? 1 : Infinity,
|
concurrency: isDialectMySQL() ? 1 : Infinity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ const syncNonLocalizedAttributes = async (entry, { model }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
|
// MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
|
||||||
await forEachAsync(entry.localizations, (localization) => updateLocalization(localization.id), {
|
await mapAsync(entry.localizations, (localization) => updateLocalization(localization.id), {
|
||||||
concurrency: isDialectMySQL() ? 1 : Infinity,
|
concurrency: isDialectMySQL() ? 1 : Infinity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user