Merge pull request #1190 from sharelatex/ta-team-importer-timeout-fix

Team Importer Timeout Fix

GitOrigin-RevId: 4951262e3eb980b45e3ba5785c1d17c58aa5009e
This commit is contained in:
Timothée Alby 2018-11-28 11:56:52 +02:00 committed by sharelatex
parent 05801085b0
commit be6950292d

View file

@ -29,13 +29,7 @@ module.exports = SubscriptionUpdater =
@addUsersToGroup(subscriptionId, [userId], callback)
addUsersToGroup: (subscriptionId, memberIds, callback)->
logger.log subscriptionId: subscriptionId, memberIds: memberIds, "adding members into mongo subscription"
searchOps =
_id: subscriptionId
insertOperation =
{ $addToSet: { member_ids: { $each: memberIds } } }
Subscription.findAndModify searchOps, insertOperation, (err, subscription) ->
@addUsersToGroupWithoutFeaturesRefresh subscriptionId, memberIds, (err) ->
return callback(err) if err?
# Only apply features updates to users, not user stubs
@ -45,6 +39,14 @@ module.exports = SubscriptionUpdater =
userIds = users.map (u) -> u._id.toString()
async.map userIds, FeaturesUpdater.refreshFeatures, callback
addUsersToGroupWithoutFeaturesRefresh: (subscriptionId, memberIds, callback)->
logger.log subscriptionId: subscriptionId, memberIds: memberIds, "adding members into mongo subscription"
searchOps =
_id: subscriptionId
insertOperation =
{ $addToSet: { member_ids: { $each: memberIds } } }
Subscription.findAndModify searchOps, insertOperation, callback
removeUserFromGroup: (subscriptionId, user_id, callback)->
searchOps =