mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Added floating threshold to member import
closes https://github.com/TryGhost/Team/issues/958 - The change allows to dynamically adjust import threshold based on current member count
This commit is contained in:
parent
ec841c0944
commit
2f2fe16944
@ -52,8 +52,18 @@ function reconfigureMembersAPI() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const getThreshold = () => {
|
/**
|
||||||
return _.get(config.get('hostSettings'), 'emailVerification.importThreshold');
|
* @description Calculates threshold based on following formula
|
||||||
|
* Threshold = max{[current number of members], [volume threshold]}
|
||||||
|
*
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
const fetchImportThreshold = async () => {
|
||||||
|
const membersTotal = await membersService.stats.getTotalMembers();
|
||||||
|
const volumeThreshold = _.get(config.get('hostSettings'), 'emailVerification.importThreshold') || Infinity;
|
||||||
|
const threshold = Math.max(membersTotal, volumeThreshold);
|
||||||
|
|
||||||
|
return threshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
const membersImporter = new MembersCSVImporter({
|
const membersImporter = new MembersCSVImporter({
|
||||||
@ -65,7 +75,7 @@ const membersImporter = new MembersCSVImporter({
|
|||||||
addJob: jobsService.addJob.bind(jobsService),
|
addJob: jobsService.addJob.bind(jobsService),
|
||||||
knex: db.knex,
|
knex: db.knex,
|
||||||
urlFor: urlUtils.urlFor.bind(urlUtils),
|
urlFor: urlUtils.urlFor.bind(urlUtils),
|
||||||
importThreshold: getThreshold()
|
fetchThreshold: fetchImportThreshold
|
||||||
});
|
});
|
||||||
|
|
||||||
const startEmailVerification = async (importedNumber) => {
|
const startEmailVerification = async (importedNumber) => {
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
"@tryghost/magic-link": "1.0.8",
|
"@tryghost/magic-link": "1.0.8",
|
||||||
"@tryghost/members-api": "1.24.1",
|
"@tryghost/members-api": "1.24.1",
|
||||||
"@tryghost/members-csv": "1.1.3",
|
"@tryghost/members-csv": "1.1.3",
|
||||||
"@tryghost/members-importer": "0.1.2",
|
"@tryghost/members-importer": "0.2.0",
|
||||||
"@tryghost/members-ssr": "1.0.9",
|
"@tryghost/members-ssr": "1.0.9",
|
||||||
"@tryghost/mw-session-from-token": "0.1.22",
|
"@tryghost/mw-session-from-token": "0.1.22",
|
||||||
"@tryghost/package-json": "1.0.2",
|
"@tryghost/package-json": "1.0.2",
|
||||||
|
@ -931,10 +931,10 @@
|
|||||||
papaparse "5.3.1"
|
papaparse "5.3.1"
|
||||||
pump "^3.0.0"
|
pump "^3.0.0"
|
||||||
|
|
||||||
"@tryghost/members-importer@0.1.2":
|
"@tryghost/members-importer@0.2.0":
|
||||||
version "0.1.2"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/members-importer/-/members-importer-0.1.2.tgz#6298fa9eff6d4a536b7c8229ad5e2bff54db92cd"
|
resolved "https://registry.yarnpkg.com/@tryghost/members-importer/-/members-importer-0.2.0.tgz#90b8829a951685773ec36ef4aaf66b76aefe0367"
|
||||||
integrity sha512-nLGVctLvt7NtqkodKztdb1smTR3FmVPgfrCrEFGZbZR5Au79a0lsjKgebLFH6D7D1dWOu/hHLSY4n3Vh93Hq0Q==
|
integrity sha512-7iLkvP1XItjUBeyP7e+rVxmeQQHv404ZPMknMPofnfksmYJ3Izz13e958D5poWLJgTdl08LAvYub0NfKaNFvGA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tryghost/errors" "^0.2.13"
|
"@tryghost/errors" "^0.2.13"
|
||||||
"@tryghost/members-csv" "^1.1.3"
|
"@tryghost/members-csv" "^1.1.3"
|
||||||
|
Loading…
Reference in New Issue
Block a user