Disallow insertion of duplicate messages.
This commit is contained in:
		
							parent
							
								
									1ccfe928f7
								
							
						
					
					
						commit
						5e3f8b9c2e
					
				|  | @ -6,6 +6,10 @@ local currentTime        = ARGV[2] | |||
| local sender             = ARGV[3] | ||||
| local guid               = ARGV[4] | ||||
| 
 | ||||
| if redis.call("HEXISTS", queueMetadataKey, guid) == 1 then | ||||
|     return tonumber(redis.call("HGET", queueMetadataKey, guid)) | ||||
| end | ||||
| 
 | ||||
| local messageId = redis.call("HINCRBY", queueMetadataKey, "counter", 1) | ||||
| 
 | ||||
| redis.call("ZADD", queueKey, "NX", messageId, message) | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ import junitparams.JUnitParamsRunner; | |||
| import junitparams.Parameters; | ||||
| import org.apache.commons.lang3.RandomStringUtils; | ||||
| import org.junit.Before; | ||||
| import org.junit.Ignore; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.whispersystems.textsecuregcm.entities.MessageProtos; | ||||
|  | @ -84,6 +85,7 @@ public class MessagesCacheTest extends AbstractRedisClusterTest { | |||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     @Ignore("Depends on incorrect duplicate-insert behavior that has since been fixed") | ||||
|     public void testRepairMetadata() { | ||||
|         final int distinctUuidCount = 17; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Jon Chambers
						Jon Chambers