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
6a4b9944
"vscode:/vscode.git/clone" did not exist on "2de36fae7b15388ea44b8953ce60682adb3429b2"
Commit
6a4b9944
authored
Jan 29, 2024
by
Michael Yang
Browse files
lint
parent
bea007de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
server/download.go
server/download.go
+4
-7
server/upload.go
server/upload.go
+1
-1
No files found.
server/download.go
View file @
6a4b9944
...
@@ -188,7 +188,7 @@ func (b *blobDownload) Run(ctx context.Context, requestURL *url.URL, opts *regis
...
@@ -188,7 +188,7 @@ func (b *blobDownload) Run(ctx context.Context, requestURL *url.URL, opts *regis
continue
continue
}
}
g
.
Go
(
func
()
error
{
g
.
Go
(
inner
,
func
()
error
{
var
err
error
var
err
error
for
try
:=
0
;
try
<
maxRetries
;
try
++
{
for
try
:=
0
;
try
<
maxRetries
;
try
++
{
w
:=
io
.
NewOffsetWriter
(
file
,
part
.
StartsAt
())
w
:=
io
.
NewOffsetWriter
(
file
,
part
.
StartsAt
())
...
@@ -238,7 +238,6 @@ func (b *blobDownload) Run(ctx context.Context, requestURL *url.URL, opts *regis
...
@@ -238,7 +238,6 @@ func (b *blobDownload) Run(ctx context.Context, requestURL *url.URL, opts *regis
}
}
b
.
done
=
true
b
.
done
=
true
return
}
}
func
(
b
*
blobDownload
)
downloadChunk
(
ctx
context
.
Context
,
requestURL
*
url
.
URL
,
w
io
.
Writer
,
part
*
blobDownloadPart
,
opts
*
registryOptions
)
error
{
func
(
b
*
blobDownload
)
downloadChunk
(
ctx
context
.
Context
,
requestURL
*
url
.
URL
,
w
io
.
Writer
,
part
*
blobDownloadPart
,
opts
*
registryOptions
)
error
{
...
@@ -411,7 +410,6 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
...
@@ -411,7 +410,6 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
type
LimitGroup
struct
{
type
LimitGroup
struct
{
*
errgroup
.
Group
*
errgroup
.
Group
context
.
Context
Semaphore
*
semaphore
.
Weighted
Semaphore
*
semaphore
.
Weighted
weight
,
max_weight
int64
weight
,
max_weight
int64
...
@@ -421,17 +419,16 @@ func NewLimitGroup(ctx context.Context, n int64) (*LimitGroup, context.Context)
...
@@ -421,17 +419,16 @@ func NewLimitGroup(ctx context.Context, n int64) (*LimitGroup, context.Context)
g
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
g
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
return
&
LimitGroup
{
return
&
LimitGroup
{
Group
:
g
,
Group
:
g
,
Context
:
ctx
,
Semaphore
:
semaphore
.
NewWeighted
(
n
),
Semaphore
:
semaphore
.
NewWeighted
(
n
),
weight
:
n
,
weight
:
n
,
max_weight
:
n
,
max_weight
:
n
,
},
ctx
},
ctx
}
}
func
(
g
*
LimitGroup
)
Go
(
fn
func
()
error
)
{
func
(
g
*
LimitGroup
)
Go
(
ctx
context
.
Context
,
fn
func
()
error
)
{
weight
:=
g
.
weight
weight
:=
g
.
weight
g
.
Semaphore
.
Acquire
(
g
.
Context
,
weight
)
_
=
g
.
Semaphore
.
Acquire
(
ctx
,
weight
)
if
g
.
Context
.
Err
()
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
return
return
}
}
...
...
server/upload.go
View file @
6a4b9944
...
@@ -172,7 +172,7 @@ func (b *blobUpload) Run(ctx context.Context, opts *registryOptions) {
...
@@ -172,7 +172,7 @@ func (b *blobUpload) Run(ctx context.Context, opts *registryOptions) {
select
{
select
{
case
<-
inner
.
Done
()
:
case
<-
inner
.
Done
()
:
case
requestURL
:=
<-
b
.
nextURL
:
case
requestURL
:=
<-
b
.
nextURL
:
g
.
Go
(
func
()
error
{
g
.
Go
(
inner
,
func
()
error
{
var
err
error
var
err
error
for
try
:=
0
;
try
<
maxRetries
;
try
++
{
for
try
:=
0
;
try
<
maxRetries
;
try
++
{
err
=
b
.
uploadPart
(
inner
,
http
.
MethodPatch
,
requestURL
,
part
,
opts
)
err
=
b
.
uploadPart
(
inner
,
http
.
MethodPatch
,
requestURL
,
part
,
opts
)
...
...
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