private < T > Task < Response < T > > createTaskWithTimeout ( final String name , final Request < T > request , final RequestContext requestContext , RequestConfig config ) { ConfigValue < Long > timeout = config . getTimeoutMs ( ) ; Task < Response < T > > requestTask ; if ( RequestGroup . isBatchable ( request , config ) ) { requestTask = createBatchableTask ( name , request , requestContext , config ) ; } else { requestTask = Task . async ( name , ( ) -> sendRequest ( request , requestContext ) ) ; } if ( ! needApplyTaskTimeout ( requestContext , timeout ) ) { return requestTask ; } else { return withTimeout ( requestTask , timeout ) ; } }
Apply timeout to a ParSeq rest . li request task through parseq timer task .