diff --git a/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/actor/LaskentaResurssiProvider.java b/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/actor/LaskentaResurssiProvider.java index 885ff8d09..d5cae577c 100644 --- a/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/actor/LaskentaResurssiProvider.java +++ b/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/actor/LaskentaResurssiProvider.java @@ -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 waitDurations, diff --git a/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/resource/ValintalaskentaKerrallaResource.java b/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/resource/ValintalaskentaKerrallaResource.java index d82bd8774..aaaadf768 100644 --- a/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/resource/ValintalaskentaKerrallaResource.java +++ b/src/main/java/fi/vm/sade/valinta/kooste/valintalaskenta/resource/ValintalaskentaKerrallaResource.java @@ -55,6 +55,11 @@ private static Throwable getUnderlyingCause(Throwable t) { return t; } + @GetMapping(value = "/lahtotiedot/jononpituus", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity jononpituus() { + return ResponseEntity.status(HttpStatus.OK).body(this.laskentaResurssiProvider.jononpituus()); + } + @GetMapping( value = "/haku/{hakuOid}/hakukohde/{hakukohdeOid}/lahtotiedot", produces = MediaType.APPLICATION_JSON_VALUE)