livepeer/go-livepeer

cacheOrchestratorStake not immediately returning upon timeout

Open

#1,407 opened on Feb 27, 2020

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Go (223 forks)auto 404
good first issuehelp wantedtype: bug

Repository metrics

Stars
 (583 stars)
PR merge metrics
 (PR metrics pending)

Description

Describe the bug A clear and concise description of what the bug is.

The cachOrchestratorStake function used to fetch the stake of orchs during discovery has a minor bug with how timeouts are handled.

Note that how we handle timeouts in [1] has a minor bug: the break applies to the innermost select (a weird design choice by golang IMO), and what happens is we may actually end up looping and hitting case <-ctx.Done() a few times until breaking out of the for-loop.

Expected behavior A clear and concise description of what you expected to happen.

If a time out occurs the function should immediately return.

Contributor guide