blob: be51058d8a3aa81ef2a1a5259fc1eb2823d40aa6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.dispatch;
import com.yahoo.search.Query;
import static com.yahoo.container.handler.Coverage.DEGRADED_BY_TIMEOUT;
/**
* Computes the timeout based solely on the query timeout
*
* @author baldersheim
*/
public class SimpleTimeoutHandler implements TimeoutHandler {
private final Query query;
SimpleTimeoutHandler(Query query) {
this.query = query;
}
@Override
public long nextTimeoutMS(int answeredNodes) {
return query.getTimeLeft();
}
@Override
public int reason() {
return DEGRADED_BY_TIMEOUT;
}
}
|