Просмотр исходного кода

only change ttl on cached packs, not temporary ones

temporary = without versioning feature enabled
cached = permanent versioned retrieved from s3
Brian Gough 10 лет назад
Родитель
Сommit
3f388fb0ac
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      services/track-changes/app/coffee/PackManager.coffee

+ 3 - 1
services/track-changes/app/coffee/PackManager.coffee

@@ -204,10 +204,12 @@ module.exports = PackManager =
 			return callback(err) if err?
 			return callback(err) if err?
 			if not pack?
 			if not pack?
 				MongoAWS.unArchivePack project_id, doc_id, pack_id, callback
 				MongoAWS.unArchivePack project_id, doc_id, pack_id, callback
-			else if pack.expiresAt?
+			else if pack.expiresAt? and not pack.temporary
 				# we only need to touch the TTL on the listing of changes in the project
 				# we only need to touch the TTL on the listing of changes in the project
 				# because diffs on individual documents are always done after that
 				# because diffs on individual documents are always done after that
 				PackManager.increaseTTL pack, callback
 				PackManager.increaseTTL pack, callback
+				# only do this for cached packs, not temporary ones to avoid older packs
+				# being kept longer than newer ones (which messes up the last update version)
 			else
 			else
 				callback(null, pack)
 				callback(null, pack)