Fix AbstractKeyValueMessageStore create time

The `RedisMessageGroupStoreTests.testMessageGroupUpdatedDateChangesWithEachAddedMessage()` can fail
 sporadically because there is no guaranty the several calls to the `System.getCurrentTimeMillis()` return the same value.

 * Fix `AbstractKeyValueMessageStore` to reuse `MessageGroup.timestamp` for the `lastModified` in case of a new group
This commit is contained in:
Artem Bilan
2016-05-18 13:35:30 -04:00
parent a5ee9bb7f9
commit 49985df858
2 changed files with 35 additions and 13 deletions

View File

@@ -144,9 +144,13 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS
if (group != null) {
metadata = new MessageGroupMetadata(group);
// When the group is new reuse "create time" as a "last modified"
metadata.setLastModified(group.getTimestamp());
}
else {
metadata.setLastModified(System.currentTimeMillis());
}
metadata.setLastModified(System.currentTimeMillis());
// store MessageGroupMetadata built from enriched MG
doStore(MESSAGE_GROUP_KEY_PREFIX + groupId, metadata);