Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
c413a550
Commit
c413a550
authored
Oct 11, 2023
by
Michael Yang
Browse files
download: handle inner errors
parent
630bb75d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
server/download.go
server/download.go
+10
-4
No files found.
server/download.go
View file @
c413a550
...
@@ -31,11 +31,13 @@ type blobDownload struct {
...
@@ -31,11 +31,13 @@ type blobDownload struct {
Total
int64
Total
int64
Completed
atomic
.
Int64
Completed
atomic
.
Int64
done
bool
Parts
[]
*
blobDownloadPart
Parts
[]
*
blobDownloadPart
context
.
CancelFunc
context
.
CancelFunc
done
bool
err
error
references
atomic
.
Int32
references
atomic
.
Int32
}
}
...
@@ -125,7 +127,11 @@ func (b *blobDownload) Prepare(ctx context.Context, requestURL *url.URL, opts *R
...
@@ -125,7 +127,11 @@ func (b *blobDownload) Prepare(ctx context.Context, requestURL *url.URL, opts *R
return
nil
return
nil
}
}
func
(
b
*
blobDownload
)
Run
(
ctx
context
.
Context
,
requestURL
*
url
.
URL
,
opts
*
RegistryOptions
)
(
err
error
)
{
func
(
b
*
blobDownload
)
Run
(
ctx
context
.
Context
,
requestURL
*
url
.
URL
,
opts
*
RegistryOptions
)
{
b
.
err
=
b
.
run
(
ctx
,
requestURL
,
opts
)
}
func
(
b
*
blobDownload
)
run
(
ctx
context
.
Context
,
requestURL
*
url
.
URL
,
opts
*
RegistryOptions
)
error
{
defer
blobDownloadManager
.
Delete
(
b
.
Digest
)
defer
blobDownloadManager
.
Delete
(
b
.
Digest
)
ctx
,
b
.
CancelFunc
=
context
.
WithCancel
(
ctx
)
ctx
,
b
.
CancelFunc
=
context
.
WithCancel
(
ctx
)
...
@@ -285,8 +291,8 @@ func (b *blobDownload) Wait(ctx context.Context, fn func(api.ProgressResponse))
...
@@ -285,8 +291,8 @@ func (b *blobDownload) Wait(ctx context.Context, fn func(api.ProgressResponse))
Completed
:
b
.
Completed
.
Load
(),
Completed
:
b
.
Completed
.
Load
(),
})
})
if
b
.
done
{
if
b
.
done
||
b
.
err
!=
nil
{
return
nil
return
b
.
err
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment