Ensure that arrays are sorted for checksum calculation

This commit is contained in:
Michael Friedrich 2018-05-29 14:19:32 +02:00
parent 26a2095426
commit 782486ce9c
1 changed files with 8 additions and 3 deletions

View File

@ -45,10 +45,15 @@ String RedisWriter::CalculateCheckSumGroups(const Array::Ptr& groups)
{ {
String output; String output;
{ /* Ensure that checksums happen in a defined order. */
ObjectLock olock(groups); Array::Ptr tmpGroups = groups->ShallowClone();
for (const String& group : groups) { tmpGroups->Sort();
{
ObjectLock olock(tmpGroups);
for (const String& group : tmpGroups) {
output += SHA1(group); output += SHA1(group);
} }
} }