Skip to content

Commit

Permalink
faucet: dont exit resetHandler on error
Browse files Browse the repository at this point in the history
there's no proper error management anyways, so we just print the error instead
and pray to the gods that it will come back up at some time
  • Loading branch information
octobocto committed Sep 9, 2024
1 parent d5e203d commit 2789a31
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions faucet-backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,12 @@ func NewFaucet(sender *drivechaind.Client) *Faucet {
totalDispensed: 0,
}

go func() {
if err := faucet.resetHandler(); err != nil {
log.Printf("unable to reset faucet handler: %s", err)
}
}()
go faucet.resetHandler()

return faucet
}

func (f *Faucet) resetHandler() error {
func (f *Faucet) resetHandler() {
ticker := time.NewTicker(5 * time.Minute)
defer ticker.Stop()

Expand All @@ -126,9 +122,10 @@ func (f *Faucet) resetHandler() error {
case <-connectionTicker.C:
height, err := f.sender.Ping()
if err != nil {
return fmt.Errorf("could not ping sender: %w", err)
log.Println("could not ping sender: %w", err)
} else {
log.Println("client ping: still connected at height", height)
}
log.Println("client ping: still connected at height", height)
}
}
}
Expand Down

0 comments on commit 2789a31

Please sign in to comment.