I have a service that authenticates a user and I put delayElement
for 2 seconds
when it is about to return a 401.
When I run through artillery, it seems to start timing out some of the requests and I was wondering what kind of resources are used for delayElement
as I was sort of hoping it just switches context away from the current request and goes to the next one that needs processing and just alarm itself back later to return the response.
private Mono<R> addDelaySpecifiedInServiceResponse(AuthServiceResponse<R> serviceResponse) {
return fromCallable(serviceResponse::getOperationResponse)
.delayElement(serviceResponse.getDelay(), Schedulers.newParallel("penalty"));
}
I tried different schedulers and seem to get a similar result.
CodePudding user response:
delayElement
in essence schedules a task on the provided Scheduler
(or the common parallel scheduler by default), so yes it "alarms itself back later" if I understand your comment correctly.