[PR #4189] [MERGED] Skip scheduling cancelled requests and always reload if unloading #16682

Closed
opened 2026-04-16 05:39:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/4189
Author: @jmorganca
Created: 5/6/2024
Status: Merged
Merged: 5/6/2024
Merged by: @jmorganca

Base: mainHead: jmorganca/schedule-cancel


📝 Commits (1)

  • 80580eb Skip scheduling cancelled requests, always reload unloaded runners

📊 Changes

1 file changed (+10 additions, -0 deletions)

View changed files

📝 server/sched.go (+10 -0)

📄 Description

This should fix the issue seen in https://github.com/ollama/ollama/pull/4187. The issue was caused by a new request coming in for the same model while it was being unloaded. I do wonder if there's a better approach here: if we know another request is coming in for a model we're loading, we shouldn't unload it on a context cancel since we'll need it anyways.

This change also discards any incoming requests that have already been cancelled so they aren't scheduled


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/4189 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 5/6/2024 **Status:** ✅ Merged **Merged:** 5/6/2024 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `jmorganca/schedule-cancel` --- ### 📝 Commits (1) - [`80580eb`](https://github.com/ollama/ollama/commit/80580ebef58a967880d4dbb6b642f1771c8c60bd) Skip scheduling cancelled requests, always reload unloaded runners ### 📊 Changes **1 file changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/sched.go` (+10 -0) </details> ### 📄 Description This should fix the issue seen in https://github.com/ollama/ollama/pull/4187. The issue was caused by a new request coming in for the same model _while_ it was being unloaded. I do wonder if there's a better approach here: if we know another request is coming in for a model we're loading, we shouldn't unload it on a context cancel since we'll need it anyways. This change also discards any incoming requests that have already been cancelled so they aren't scheduled --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 05:39:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#16682