Skip to content

Commit fe16ddc

Browse files
committed
Old version permits have no permitRequest object
Old version permits have no permitRequest object .. 2
1 parent 151be66 commit fe16ddc

File tree

1 file changed

+3
-0
lines changed
  • osgp/platform/osgp-throttling-service/src/main/java/org/opensmartgridplatform/throttling/services

1 file changed

+3
-0
lines changed

osgp/platform/osgp-throttling-service/src/main/java/org/opensmartgridplatform/throttling/services/RedisPermitService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public boolean removePermit(
138138
final boolean released =
139139
permits.stream()
140140
.filter(Objects::nonNull)
141+
.filter(p -> p.permitRequest() != null)
141142
.filter(
142143
p ->
143144
p.permitRequest().getClientId() == permitRequest.getClientId()
@@ -191,6 +192,7 @@ public Optional<Permit> findByClientIdAndRequestId(final int clientId, final int
191192
.map(this.redisson::getScoredSortedSet)
192193
.flatMap(RScoredSortedSet::stream)
193194
.map(p -> (Permit) p)
195+
.filter(p -> p.permitRequest() != null)
194196
.filter(
195197
p ->
196198
p.permitRequest().getClientId() == clientId
@@ -208,6 +210,7 @@ public long countByClientId(final int clientId) {
208210
.map(this.redisson::getScoredSortedSet)
209211
.flatMap(RScoredSortedSet::stream)
210212
.map(p -> (Permit) p)
213+
.filter(p -> p.permitRequest() != null)
211214
.filter(p -> p.permitRequest().getClientId() == clientId)
212215
.count();
213216
}

0 commit comments

Comments
 (0)