浏览代码

always remove from in progress map on download

Bruce MacDonald 1 年之前
父节点
当前提交
f020e1d519
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      server/download.go

+ 1 - 2
server/download.go

@@ -113,6 +113,7 @@ var chunkSize = 1024 * 1024 // 1 MiB in bytes
 
 
 // doDownload downloads a blob from the registry and stores it in the blobs directory
 // doDownload downloads a blob from the registry and stores it in the blobs directory
 func doDownload(ctx context.Context, mp ModelPath, regOpts *RegistryOptions, f *FileDownload, fn func(api.ProgressResponse)) error {
 func doDownload(ctx context.Context, mp ModelPath, regOpts *RegistryOptions, f *FileDownload, fn func(api.ProgressResponse)) error {
+	defer inProgress.Delete(f.Digest)
 	var size int64
 	var size int64
 
 
 	fi, err := os.Stat(f.FilePath + "-partial")
 	fi, err := os.Stat(f.FilePath + "-partial")
@@ -208,8 +209,6 @@ outerLoop:
 		inProgress.Store(f.Digest, f)
 		inProgress.Store(f.Digest, f)
 	}
 	}
 
 
-	inProgress.Delete(f.Digest)
-
 	log.Printf("success getting %s\n", f.Digest)
 	log.Printf("success getting %s\n", f.Digest)
 	return nil
 	return nil
 }
 }