Selaa lähdekoodia

fix update to work with redis cluster

the items do not have the same tag, so we must delete the entry from the
docsWithHistoryOps set outside the multi.
Brian Gough 9 vuotta sitten
vanhempi
sitoutus
3b5a07d530
1 muutettua tiedostoa jossa 5 lisäystä ja 4 poistoa
  1. 5 4
      services/track-changes/app/coffee/RedisManager.coffee

+ 5 - 4
services/track-changes/app/coffee/RedisManager.coffee

@@ -21,12 +21,13 @@ module.exports = RedisManager =
 		# Delete all the updates which have been applied (exact match)
 		# Delete all the updates which have been applied (exact match)
 		for update in docUpdates or []
 		for update in docUpdates or []
 			multi.lrem Keys.uncompressedHistoryOps({doc_id}), 0, update
 			multi.lrem Keys.uncompressedHistoryOps({doc_id}), 0, update
-		# It's ok to delete the doc_id from the set here. Even though the list
-		# of updates may not be empty, we will continue to process it until it is.
-		multi.srem Keys.docsWithHistoryOps({project_id}), doc_id
 		multi.exec (error, results) ->
 		multi.exec (error, results) ->
 			return callback(error) if error?
 			return callback(error) if error?
-			callback null
+			# It's ok to delete the doc_id from the set here. Even though the list
+			# of updates may not be empty, we will continue to process it until it is.
+			rclient.srem Keys.docsWithHistoryOps({project_id}), doc_id, (error) ->
+				return callback(error) if error?
+				callback null
 
 
 	getDocIdsWithHistoryOps: (project_id, callback = (error, doc_ids) ->) ->
 	getDocIdsWithHistoryOps: (project_id, callback = (error, doc_ids) ->) ->
 		rclient.smembers Keys.docsWithHistoryOps({project_id}), callback
 		rclient.smembers Keys.docsWithHistoryOps({project_id}), callback