mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-11 07:45:12 +00:00
Merge pull request #1843 from overleaf/ta-limit-affiliation-rate
Limit the Number of Affiliations Created Simultaneously GitOrigin-RevId: 242d3f3a2859eb2114f43091e7ca52534b282396
This commit is contained in:
parent
e659703745
commit
4583c25b1b
1 changed files with 4 additions and 2 deletions
|
@ -17,6 +17,7 @@ const UserGetter = require('../User/UserGetter')
|
|||
const { addAffiliation } = require('../Institutions/InstitutionsAPI')
|
||||
const FeaturesUpdater = require('../Subscription/FeaturesUpdater')
|
||||
const async = require('async')
|
||||
const ASYNC_AFFILIATIONS_LIMIT = 10
|
||||
|
||||
module.exports = InstitutionsController = {
|
||||
confirmDomain(req, res, next) {
|
||||
|
@ -48,8 +49,9 @@ var affiliateUsers = function(hostname, callback) {
|
|||
return callback(error)
|
||||
}
|
||||
|
||||
return async.map(
|
||||
return async.mapLimit(
|
||||
users,
|
||||
ASYNC_AFFILIATIONS_LIMIT,
|
||||
(user, innerCallback) =>
|
||||
affiliateUserByReversedHostname(
|
||||
user,
|
||||
|
@ -70,7 +72,7 @@ var affiliateUserByReversedHostname = function(
|
|||
const matchingEmails = user.emails.filter(
|
||||
email => email.reversedHostname === reversedHostname
|
||||
)
|
||||
return async.map(
|
||||
return async.mapSeries(
|
||||
matchingEmails,
|
||||
(email, innerCallback) =>
|
||||
addAffiliation(
|
||||
|
|
Loading…
Add table
Reference in a new issue