Skip to content

Commit

Permalink
refactor(linux): location sensor code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jun 11, 2023
1 parent 0ec1910 commit b72cfc3
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions internal/linux/locationSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,17 @@ func LocationUpdater(ctx context.Context, locationInfoCh chan interface{}) {
}

go func() {
for {
select {
case <-ctx.Done():
log.Debug().Caller().
Msg("Stopping location updater.")
err = NewBusRequest(ctx, systemBus).
Path(clientPath).
Destination(geoclueInterface).
Call("org.freedesktop.GeoClue2.Client.Stop")
if err != nil {
log.Debug().Caller().Err(err).
Msg("Failed to stop location updater.")
return
}
}
<-ctx.Done()
log.Debug().Caller().
Msg("Stopping location updater.")
err = NewBusRequest(ctx, systemBus).
Path(clientPath).
Destination(geoclueInterface).
Call("org.freedesktop.GeoClue2.Client.Stop")
if err != nil {
log.Debug().Caller().Err(err).
Msg("Failed to stop location updater.")
return
}
}()
}
Expand Down

0 comments on commit b72cfc3

Please sign in to comment.