Skip to content

Commit

Permalink
Temporarily increase elan ctx timeouts (#256)
Browse files Browse the repository at this point in the history
* Temporarily increase elan ctx timeouts

* Linting
  • Loading branch information
isobelormiston authored Aug 15, 2023
1 parent a872923 commit aefafb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion elan/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func New(url string, tls bool, tokenFile string) (Client, error) {
if strings.Contains(url, "://") {
return &elanClient{
s: createServer(url, 8, 10240, 10*1024*1024),
timeout: 1 * time.Minute,
timeout: 3 * time.Minute,
}, nil
}
client, err := rexclient.New("mettle", url, tls, tokenFile)
Expand Down
13 changes: 11 additions & 2 deletions elan/rpc/eclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rpc

import (
"context"
"fmt"
"io"
"os"
"time"
Expand All @@ -28,7 +29,11 @@ func (e *elanClient) Healthcheck() error {
func (e *elanClient) ReadBlob(dg *pb.Digest) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), e.timeout)
defer cancel()
return e.s.readAllBlob(ctx, "cas", dg)
blob, err := e.s.readAllBlob(ctx, "cas", dg)
if err != nil {
return blob, fmt.Errorf("Error reading blob: %w", err)
}
return blob, nil
}

func (e *elanClient) WriteBlob(b []byte) (*pb.Digest, error) {
Expand All @@ -47,7 +52,11 @@ func (e *elanClient) WriteBlob(b []byte) (*pb.Digest, error) {
if e.s.blobExists(ctx, key) {
return dg, nil
}
return dg, e.s.bucket.WriteAll(ctx, key, b)
err := e.s.bucket.WriteAll(ctx, key, b)
if err != nil {
return dg, fmt.Errorf("Error writing blob: %w", err)
}
return dg, nil
}

func (e *elanClient) UpdateActionResult(req *pb.UpdateActionResultRequest) (*pb.ActionResult, error) {
Expand Down

0 comments on commit aefafb6

Please sign in to comment.