Skip to content

Commit 5ee768f

Browse files
committed
always use at least some timeout
1 parent 0a851e4 commit 5ee768f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/common/inference/service.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ pub struct InferenceService {
7676

7777
static 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+
7984
impl 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,

0 commit comments

Comments
 (0)