From 291def6adbdb191e1a67f2e3f231cb54fe18d417 Mon Sep 17 00:00:00 2001 From: Yashwanth A <123303508+yashwanth2706@users.noreply.github.com> Date: Wed, 5 Feb 2025 23:30:26 +0530 Subject: [PATCH] server: increase timeout in stall detection from 5s to 30s (#8831) In some cases, downloads slow due to disk i/o or other factors, causing the download to restart a part. This causes the download to "reverse" in percent completion. By increasing the timeout to 30s, this should happen less frequently. --- server/download.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/download.go b/server/download.go index 857b16926..8f49351e4 100644 --- a/server/download.go +++ b/server/download.go @@ -368,7 +368,7 @@ func (b *blobDownload) downloadChunk(ctx context.Context, requestURL *url.URL, w lastUpdated := part.lastUpdated part.lastUpdatedMu.Unlock() - if !lastUpdated.IsZero() && time.Since(lastUpdated) > 5*time.Second { + if !lastUpdated.IsZero() && time.Since(lastUpdated) > 30*time.Second { const msg = "%s part %d stalled; retrying. If this persists, press ctrl-c to exit, then 'ollama pull' to find a faster connection." slog.Info(fmt.Sprintf(msg, b.Digest[7:19], part.N)) // reset last updated