Skip to content

Commit

Permalink
obolapi: update publish lock timeout to 30s (#2685)
Browse files Browse the repository at this point in the history
Update timeout to 30s for publishing lock to obol-api. This ensures that DKG doesn't error if lock files are large enough (>200kb) whose publishing takes more than 5s. 

30s is an empirical timeout value which is safe for publishing large lock files (1.5MB)  to obol-api.

category: refactor 
ticket: none
  • Loading branch information
xenowits committed Nov 9, 2023
1 parent 5d09ed4 commit 9591236
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/obolapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ func (c Client) url() *url.URL {
return baseURL
}

// PublishLock posts the lockfile to obol-api.
// PublishLock posts the lockfile to obol-api. It has a 30s timeout.
func (c Client) PublishLock(ctx context.Context, lock cluster.Lock) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
// TODO(xenowits): Reduce the timeout once the obol-api is optimised for publishing large lock files.
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()

addr := c.url()
Expand Down

0 comments on commit 9591236

Please sign in to comment.