Why Mono/Flux spring-boot-reactive request gets cancelled if api gets called twice or multiple times?

Viewed 17

My Controller is

@RestController
@RequestMapping("/test")
public class HelloController {
    @Autowired
    private HelloService helloService;

    @GetMapping
    public Mono<String> testing() {
        return helloService.testMono();
    }
}

The method in HelloService is

public Mono<String> testMono(){
       return Mono.just("One ").delayElement(Duration.ofSeconds(10)).log();
}

The issue is when I call the API twice first one gets cancelled automatically but the processing doesn't stop in the backend.

enter image description here

Logs in the terminal for the first API call look like

enter image description here

So how should I prevent it from being gets cancelled? or if it is not possible, how can I revert the changes if any are being done in the backend?

0 Answers
Related