Prechádzať zdrojové kódy

added comment about query memory usage for toArray

Brian - Work 10 rokov pred
rodič
commit
f64969c784

+ 7 - 0
services/track-changes/app/coffee/PackManager.coffee

@@ -88,6 +88,10 @@ module.exports = PackManager =
 
 
 		needMore = false  # keep track of whether we need to load more data
 		needMore = false  # keep track of whether we need to load more data
 		updates = [] # used to accumulate the set of results
 		updates = [] # used to accumulate the set of results
+
+		# FIXME: packs are big so we should accumulate the results
+		# incrementally instead of using .toArray() to avoid reading all
+		# of the changes into memory
 		cursor.toArray (err, result) ->
 		cursor.toArray (err, result) ->
 			unpackedSet = PackManager._unpackResults(result)
 			unpackedSet = PackManager._unpackResults(result)
 			updates = PackManager._filterAndLimit(updates, unpackedSet, filterFn, limit)
 			updates = PackManager._filterAndLimit(updates, unpackedSet, filterFn, limit)
@@ -141,6 +145,9 @@ module.exports = PackManager =
 
 
 		updates = [] # used to accumulate the set of results
 		updates = [] # used to accumulate the set of results
 
 
+		# FIXME: packs are big so we should accumulate the results
+		# incrementally instead of using .toArray() to avoid reading all
+		# of the changes into memory
 		cursor.toArray (err, result) ->
 		cursor.toArray (err, result) ->
 			if err?
 			if err?
 				return callback err, result
 				return callback err, result