Преглед изворни кода

Merge pull request #91 from overleaf/bg-fix-multi-getdoctimestamps

fix getDocTimestamps for multiple docs
Brian Gough пре 7 година
родитељ
комит
f172650601
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      services/document-updater/app/coffee/RedisManager.coffee

+ 4 - 4
services/document-updater/app/coffee/RedisManager.coffee

@@ -4,6 +4,7 @@ logger = require('logger-sharelatex')
 metrics = require('./Metrics')
 Errors = require "./Errors"
 crypto = require "crypto"
+async = require "async"
 ProjectHistoryRedisManager = require "./ProjectHistoryRedisManager"
 
 # Sometimes Redis calls take an unexpectedly long time.  We have to be
@@ -289,10 +290,9 @@ module.exports = RedisManager =
 
 	getDocTimestamps: (doc_ids, callback = (error, result) ->) ->
 		# get lastupdatedat timestamps for an array of doc_ids
-		multi = rclient.multi()
-		for doc_id in doc_ids
-			multi.get keys.lastUpdatedAt(doc_id: doc_id)
-		multi.exec callback
+		async.mapSeries doc_ids, (doc_id, cb) ->
+			rclient.get keys.lastUpdatedAt(doc_id: doc_id), cb
+		, callback
 
 	queueFlushAndDeleteProject: (project_id, callback) ->
 		# store the project id in a sorted set ordered by time