Macbook app prevents display sleeping

I’ve just found that a the TrainerRoad app on my Macbook is preventing the display from sleeping when idle. I’ve noticed that this happens sometimes and wondered what the cause was, just did some searching and found a useful terminal command (pmset -g assertions) which shows that TR has a block in place:

pid 7900(TrainerRoad): [0x00128aeb00058a4d] 03:13:36 PreventUserIdleDisplaySleep named: “Ride in Progress”

The name suggests that this should be while a ride is in progress but I have no ride going at the moment. Quitting TR removes the block and restarting it doesn’t bring it back suggesting that this is being put in place when I start a ride and not being removed.

Steve

Agreed. This isn’t the end of the world, but there have been a few days where I’ve done a ride in the morning, then left the TR app open so I would remember to write some notes about my ride later in the day, only to discover that my battery is dead, probably from the power assertion preventing display sleep.

I can confirm that the power assertion is added at the start of a workout, and then not removed after the workout is ended.

To replicate, on the latest Mac app release, I did

  1. pmset -g assertions > app_not_started.txt (No TR assertions)
  2. Start the TR app.
  3. pmset -g assertions > app_started.txt (No TR assertions)
  4. Load up a workout: Lamarck :wink:
  5. pmset -g assertions > workout_loaded.txt (No TR assertions)
  6. START the workout…
  7. pmset -g assertions > workout_started.txt (Now there’s a power assertion for the TR process).
  8. ENDED the workout because I have to do that tomorrow morning and I’m already nervous enough without piling on some bonus stress!
  9. pmset -g assertions > workout_ended.txt (The power assertion is still active).
  10. Quit the app.
  11. pmset -g assertions > app_quit.txt (The power assertion is now gone).

Redirecting the output into text files was just so I could diff the output.

I would imagine it needs an IOPMAssertionRelease after the workout ends, but that’s macOS only, and I feel like I’ve heard @Nate_Pearson say the Mac stuff is using a shared iOS / macOS (and maybe more) codebase (Xamarin?), so maybe that stuff is shelling out for Mac or something.

Anyway, thanks for a great product!