fix getDocTimestamps for multiple docs

This commit is contained in:
Brian Gough 2019-09-30 13:41:47 +01:00
parent 89a90399fe
commit 33fadf51c1

View file

@ -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