mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
f8d4cdda84
sharding: goroutine for better testing (#216) Former-commit-id: 2c70ee0892b1e36d5b4473f1e5bba5f151ee449c [formerly 3d91ae5c4288ab27fbf09347d5b12164802726bc] Former-commit-id: 24085acd2b045f549a3356ef0da219cb91149650
20 lines
449 B
Go
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())
|
|
}
|
|
}
|
|
}
|