prysm-pulse/sharding/utils/service.go
Raul Jordan f8d4cdda84 Simplify Goroutines for Better Testing (#216)
sharding: goroutine for better testing (#216)
Former-commit-id: 2c70ee0892b1e36d5b4473f1e5bba5f151ee449c [formerly 3d91ae5c4288ab27fbf09347d5b12164802726bc]
Former-commit-id: 24085acd2b045f549a3356ef0da219cb91149650
2018-06-27 13:19:36 -05:00

20 lines
449 B
Go

package utils
import (
"github.com/ethereum/go-ethereum/log"
)
// HandleServiceErrors manages a goroutine that listens for errors broadcast to
// this service's error channel. This serves as a final step for error logging
// and is stopped upon the service shutting down.
func HandleServiceErrors(done <-chan struct{}, errChan <-chan error) {
for {
select {
case <-done:
return
case err := <-errChan:
log.Error(err.Error())
}
}
}