mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-09-16 03:39:05 +02:00
Increase model pull retry delay and attempts
Raised the base delay for model pull retries from 1s to 3s and updated log output to show seconds instead of milliseconds. Also increased the number of retries for model pull in integration tests from 3 to 5 to improve robustness.
This commit is contained in:
parent
de379d73b2
commit
c705432510
@ -429,7 +429,7 @@ public class OllamaAPI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int numberOfRetries = 0;
|
int numberOfRetries = 0;
|
||||||
long baseDelayMillis = 1000L; // 1 second base delay
|
long baseDelayMillis = 3000L; // 1 second base delay
|
||||||
while (numberOfRetries < numberOfRetriesForModelPull) {
|
while (numberOfRetries < numberOfRetriesForModelPull) {
|
||||||
try {
|
try {
|
||||||
this.doPullModel(modelName);
|
this.doPullModel(modelName);
|
||||||
@ -450,8 +450,8 @@ public class OllamaAPI {
|
|||||||
int attempt = currentRetry + 1;
|
int attempt = currentRetry + 1;
|
||||||
if (attempt < maxRetries) {
|
if (attempt < maxRetries) {
|
||||||
long backoffMillis = baseDelayMillis * (1L << currentRetry);
|
long backoffMillis = baseDelayMillis * (1L << currentRetry);
|
||||||
logger.error("Failed to pull model {}, retrying in {} ms... (attempt {}/{})",
|
logger.error("Failed to pull model {}, retrying in {} s... (attempt {}/{})",
|
||||||
modelName, backoffMillis, attempt, maxRetries);
|
modelName, backoffMillis/1000, attempt, maxRetries);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(backoffMillis);
|
Thread.sleep(backoffMillis);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
@ -75,7 +75,7 @@ class OllamaAPIIntegrationTest {
|
|||||||
}
|
}
|
||||||
api.setRequestTimeoutSeconds(120);
|
api.setRequestTimeoutSeconds(120);
|
||||||
api.setVerbose(true);
|
api.setVerbose(true);
|
||||||
api.setNumberOfRetriesForModelPull(3);
|
api.setNumberOfRetriesForModelPull(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user