Skip to content

Early escape from insert/insertIfNotExists if event hash is 0 #781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ internal class LaunchRulesConsequence(
logTag,
"Event History operation for id ${consequence.id} - event hash is 0"
)
return
}

// For INSERT_IF_NOT_EXISTS, check if the event exists first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ internal class LaunchTokenFinder(val event: Event, val extensionApi: ExtensionAp
return EMPTY_STRING
}
val eventDataMap = event.eventData.flattening()
val value = eventDataMap[key]
return value
return eventDataMap[key]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,26 @@ public void testGetFnv1aHash_WithMask_VerifyEventDataMapSortedWithCaseSensitivit
final long expectedHash = 3344627991L;
assertEquals(expectedHash, hash);
}

@Test
public void testGetFnv1aHash_EmptyMap() {
// setup
final Map<String, Object> map = new HashMap<>();
// test
final long hash = MapUtilsKt.convertMapToFnv1aHash(map, null);
// verify empty map returns 0 hash
final long expectedHash = 0L;
assertEquals(expectedHash, hash);
}

@Test
public void testGetFnv1aHash_NullMap() {
// setup
final Map<String, Object> map = null;
// test
final long hash = MapUtilsKt.convertMapToFnv1aHash(map, null);
// verify null map returns 0 hash
final long expectedHash = 0L;
assertEquals(expectedHash, hash);
}
}
Loading