Skip to content

Commit

Permalink
squashme
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Jan 14, 2025
1 parent 6c7fa2f commit 201f64d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions service/bfg/bfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,31 @@ func NewServer(cfg *Config) (*Server, error) {
}

func (s *Server) queueCheckForTipChange() {
// fixme
s.checkForTipChange <- struct{}{}
select {
case s.checkForTipChange <- struct{}{}:
default:
}
}

func (s *Server) tipChangeChecker(ctx context.Context) {
defer s.wg.Done()

select {
case <-ctx.Done():
return
case <-s.checkForTipChange:
}

log.Tracef("starting tip change checker ticker")

btcInterval := 5 * time.Second
ticker := time.NewTicker(btcInterval)

for {
select {
case <-ctx.Done():
return
case <-s.checkForTipChange:
go s.queueCheckForTipChange()
case <-ticker.C:

height, err := s.btcClient.Height(ctx)
if err != nil {
Expand Down

0 comments on commit 201f64d

Please sign in to comment.