Skip to content

Commit

Permalink
OK-611 Lisätty jononpituus endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jkorri committed Dec 3, 2024
1 parent d7d35ea commit 3850a0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ public void lueParametrit() {
});
}

public int jononpituus() {
return this.limiters.values().stream()
.map(l -> l.getWaiting())
.max(Integer::compareTo)
.orElseThrow();
}

private void tallennaLokitJaMetriikat(
String hakukohdeOid,
Map<String, Duration> waitDurations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ private static Throwable getUnderlyingCause(Throwable t) {
return t;
}

@GetMapping(value = "/lahtotiedot/jononpituus", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Integer> jononpituus() {
return ResponseEntity.status(HttpStatus.OK).body(this.laskentaResurssiProvider.jononpituus());
}

@GetMapping(
value = "/haku/{hakuOid}/hakukohde/{hakukohdeOid}/lahtotiedot",
produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down

0 comments on commit 3850a0b

Please sign in to comment.