Skip to content

Commit aa4ea49

Browse files
committed
Change QueryPlanInit to support thresholdMicros per hash
Effectively means that we can provide a thresholdMicros per query plan hash [for the plans that we want collected]
1 parent bab839f commit aa4ea49

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ebean-api/src/main/java/io/ebean/meta/QueryPlanInit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public void remove(String hash) {
8181
* Return the threshold in micros to use for the given hash.
8282
*/
8383
public long thresholdMicros(String hash) {
84-
long threshold = hashes.get(hash);
85-
return threshold < 1 ? defaultThresholdMicros : threshold;
84+
Long threshold = hashes.get(hash);
85+
return threshold == null || threshold < 1 ? defaultThresholdMicros : threshold;
8686
}
8787

8888
/**

ebean-api/src/test/java/io/ebean/meta/QueryPlanInitTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void addWithThresholds() {
3636
assertThat(init.includeHash("xJunk")).isFalse();
3737
assertThat(init.includeHash("xOne")).isTrue();
3838
assertThat(init.includeHash("xTwo")).isTrue();
39+
assertThat(init.thresholdMicros("xJunk")).isEqualTo(1000L);
3940
assertThat(init.thresholdMicros("xOne")).isEqualTo(1000L);
4041
assertThat(init.thresholdMicros("xTwo")).isEqualTo(2000L);
4142
}

0 commit comments

Comments
 (0)