From 1c27eb950a8fd3c37daf411be53c45e0273b0589 Mon Sep 17 00:00:00 2001 From: thcai Date: Mon, 12 Aug 2024 19:30:39 +0200 Subject: [PATCH] test brain overload decrease --- .../ns4kafka/controller/SchemaController.java | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/michelin/ns4kafka/controller/SchemaController.java b/src/main/java/com/michelin/ns4kafka/controller/SchemaController.java index ccc66635..82f44789 100644 --- a/src/main/java/com/michelin/ns4kafka/controller/SchemaController.java +++ b/src/main/java/com/michelin/ns4kafka/controller/SchemaController.java @@ -183,32 +183,33 @@ public Mono> delete(String namespace, @PathVariable String su .deleteAllVersions(ns, subject) .map(deletedVersionIds -> HttpResponse.noContent()); }); + + } + // delete a specific version of the schema - } else { - return schemaService.getSubject(ns, subject, version.get()) - .map(Optional::of) - .defaultIfEmpty(Optional.empty()) - .flatMap(subjectOptional -> { - if (subjectOptional.isEmpty()) { - return Mono.just(HttpResponse.notFound()); - } + return schemaService.getSubject(ns, subject, version.get()) + .map(Optional::of) + .defaultIfEmpty(Optional.empty()) + .flatMap(subjectOptional -> { + if (subjectOptional.isEmpty()) { + return Mono.just(HttpResponse.notFound()); + } - if (dryrun) { - return Mono.just(HttpResponse.noContent()); - } + if (dryrun) { + return Mono.just(HttpResponse.noContent()); + } - Schema schemaVersionToDelete = subjectOptional.get(); - return schemaService - .deleteVersion(ns, subject, version.get()) - .flatMap(optionalLatestSubject -> { - sendEventLog(schemaVersionToDelete, - optionalLatestSubject.isEmpty() ? ApplyStatus.deleted : ApplyStatus.changed, - schemaVersionToDelete.getSpec(), - optionalLatestSubject.isEmpty() ? null : optionalLatestSubject.get().getSpec()); - return Mono.just(HttpResponse.noContent()); - }); - }); - } + Schema schemaVersionToDelete = subjectOptional.get(); + return schemaService + .deleteVersion(ns, subject, version.get()) + .flatMap(optionalLatestSubject -> { + sendEventLog(schemaVersionToDelete, + optionalLatestSubject.isEmpty() ? ApplyStatus.deleted : ApplyStatus.changed, + schemaVersionToDelete.getSpec(), + optionalLatestSubject.isEmpty() ? null : optionalLatestSubject.get().getSpec()); + return Mono.just(HttpResponse.noContent()); + }); + }); } /**