File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,11 @@ pub struct InferenceService {
7676
7777static INFERENCE_SERVICE : RwLock < Option < Arc < InferenceService > > > = RwLock :: new ( None ) ;
7878
79+ /// We assume that the inference provider will handle timeouts itself, if
80+ /// not provided by the user or configured. But we need ensurance, that we don't
81+ /// wait forever for a response.
82+ static DEFAULT_INFERENCE_TIMEOUT_SECS : u64 = 10 * 60 ; // 10 minutes
83+
7984impl InferenceService {
8085 pub fn new ( config : Option < InferenceConfig > ) -> Self {
8186 let config = config. unwrap_or_default ( ) ;
@@ -85,13 +90,8 @@ impl InferenceService {
8590 token : _,
8691 } = & config;
8792
88- let client_builder = Client :: builder ( ) ;
89-
90- let client_builder = if let Some ( timeout_secs) = timeout {
91- client_builder. timeout ( Duration :: from_secs ( * timeout_secs) )
92- } else {
93- client_builder
94- } ;
93+ let timeout = timeout. unwrap_or ( DEFAULT_INFERENCE_TIMEOUT_SECS ) ;
94+ let client_builder = Client :: builder ( ) . timeout ( Duration :: from_secs ( timeout) ) ;
9595
9696 Self {
9797 config,
You can’t perform that action at this time.
0 commit comments