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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user