33
33
public class AsyncWorkerThread extends WorkerThread {
34
34
// protected ConcurrentHashMap requestsInBackend;
35
35
protected static final Logger logger = LoggerFactory .getLogger (AsyncWorkerThread .class );
36
- protected static final long MODEL_LOAD_TIMEOUT = 10L ;
36
+ protected static final long WORKER_TIMEOUT = 2L ;
37
37
38
38
protected boolean loadingFinished ;
39
39
protected CountDownLatch latch ;
@@ -53,6 +53,7 @@ public AsyncWorkerThread(
53
53
@ Override
54
54
public void run () {
55
55
responseTimeout = model .getResponseTimeout ();
56
+ startupTimeout = model .getStartupTimeout ();
56
57
Thread thread = Thread .currentThread ();
57
58
thread .setName (getWorkerName ());
58
59
currentThread .set (thread );
@@ -80,11 +81,11 @@ public void run() {
80
81
81
82
if (loadingFinished == false ) {
82
83
latch = new CountDownLatch (1 );
83
- if (!latch .await (MODEL_LOAD_TIMEOUT , TimeUnit .MINUTES )) {
84
+ if (!latch .await (startupTimeout , TimeUnit .SECONDS )) {
84
85
throw new WorkerInitializationException (
85
- "Worker did not load the model within"
86
- + MODEL_LOAD_TIMEOUT
87
- + " mins " );
86
+ "Worker did not load the model within "
87
+ + startupTimeout
88
+ + " seconds " );
88
89
}
89
90
}
90
91
@@ -99,7 +100,7 @@ public void run() {
99
100
logger .debug ("Shutting down the thread .. Scaling down." );
100
101
} else {
101
102
logger .debug (
102
- "Backend worker monitoring thread interrupted or backend worker process died., responseTimeout:"
103
+ "Backend worker monitoring thread interrupted or backend worker process died. responseTimeout:"
103
104
+ responseTimeout
104
105
+ "sec" ,
105
106
e );
0 commit comments