mirror of
				https://github.com/amithkoujalgi/ollama4j.git
				synced 2025-10-31 16:40:41 +01: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:
		| @@ -429,7 +429,7 @@ public class OllamaAPI { | ||||
|             return; | ||||
|         } | ||||
|         int numberOfRetries = 0; | ||||
|         long baseDelayMillis = 1000L; // 1 second base delay | ||||
|         long baseDelayMillis = 3000L; // 1 second base delay | ||||
|         while (numberOfRetries < numberOfRetriesForModelPull) { | ||||
|             try { | ||||
|                 this.doPullModel(modelName); | ||||
| @@ -450,8 +450,8 @@ public class OllamaAPI { | ||||
|         int attempt = currentRetry + 1; | ||||
|         if (attempt < maxRetries) { | ||||
|             long backoffMillis = baseDelayMillis * (1L << currentRetry); | ||||
|             logger.error("Failed to pull model {}, retrying in {} ms... (attempt {}/{})", | ||||
|                     modelName, backoffMillis, attempt, maxRetries); | ||||
|             logger.error("Failed to pull model {}, retrying in {} s... (attempt {}/{})", | ||||
|                     modelName, backoffMillis/1000, attempt, maxRetries); | ||||
|             try { | ||||
|                 Thread.sleep(backoffMillis); | ||||
|             } catch (InterruptedException ie) { | ||||
|   | ||||
| @@ -75,7 +75,7 @@ class OllamaAPIIntegrationTest { | ||||
|         } | ||||
|         api.setRequestTimeoutSeconds(120); | ||||
|         api.setVerbose(true); | ||||
|         api.setNumberOfRetriesForModelPull(3); | ||||
|         api.setNumberOfRetriesForModelPull(5); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 amithkoujalgi
					amithkoujalgi