From a2ac37ac99d6f969dbdb6752208df9b3cd31cbdb Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 28 Jun 2017 10:06:50 +0100 Subject: [PATCH] comments about optimistic loading --- services/docstore/app/coffee/DocManager.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/docstore/app/coffee/DocManager.coffee b/services/docstore/app/coffee/DocManager.coffee index 45d2158dbf..a6192d083d 100644 --- a/services/docstore/app/coffee/DocManager.coffee +++ b/services/docstore/app/coffee/DocManager.coffee @@ -65,6 +65,7 @@ module.exports = DocManager = callback(null, docs) getAllNonDeletedDocs: (project_id, filter, callback = (error, docs) ->) -> + # load docs optimistically, only unarchive if results are incomplete DocManager._getAllDocs project_id, filter, (error, docs) -> return callback(error) if error? # check if any docs have been archived @@ -74,8 +75,10 @@ module.exports = DocManager = if error? logger.err err:error, project_id:project_id, "error unarchiving docs" return callback(error) + # now reload the docs after unarchiving DocManager._getAllDocs project_id, filter, callback else + # return docs immediately, nothing in s3 return callback(null, docs) updateDoc: (project_id, doc_id, lines, version, ranges, callback = (error, modified, rev) ->) ->