Ensure flusher is not nil
This commit is contained in:
parent
0ea001602d
commit
9232cb2634
|
|
@ -314,6 +314,10 @@ func (m *Manager) PullModel(ctx context.Context, model string, w http.ResponseWr
|
|||
flusher: flusher,
|
||||
}
|
||||
|
||||
if flusher == nil {
|
||||
m.log.Warnln("HTTP response writer does not support flushing, progress updates may be delayed")
|
||||
}
|
||||
|
||||
// Pull the model using the Docker model distribution client
|
||||
m.log.Infoln("Pulling model:", model)
|
||||
err := m.distributionClient.PullModel(ctx, model, progressWriter)
|
||||
|
|
@ -337,6 +341,8 @@ func (w *progressResponseWriter) Write(p []byte) (n int, err error) {
|
|||
return 0, err
|
||||
}
|
||||
// Flush the response to ensure the chunk is sent immediately
|
||||
w.flusher.Flush()
|
||||
if w.flusher != nil {
|
||||
w.flusher.Flush()
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue