Brave sometimes preventing macOS from entering sleep mode

Description of the issue:

Lately I’ve been noticing an alarming issue where I close the lid on my MacBook Pro for the day, and when I come back to it the next day, my battery is below half charge, or is nearly completely drained!

In the last week, I went to Activity Monitor and looked in the Energy tab. It has a category for “Preventing Sleep,” and Brave was the only app. where it said “Yes” under that category. Unfortunately, it does not give any indication as to why.

Today as I post this, this problem with battery drain happened again, but when I looked at the Energy tab under Activity Monitor, and looked at “Preventing Sleep,” it said “No” for Brave. It did not list any app. as preventing sleep mode. Frustrating.

I suppose what I could do until this is diagnosed is quit out of Brave before closing up my MacBook Pro for the day, and then relaunch it when I want to get back to it. It’s been good about restoring all browser windows and tabs on restart.

How can this issue be reproduced?

I only have a suspicion about what’s causing this. I do not know yet how to reproduce it in a way that would satisfy a debugging process.

What I can say is that I have 13 (Brave) browser windows open, with many tabs open on most of them (at least 20 each). Most of them are videos I have cued up to watch. One of the windows is using a stock quote web app. (so, it’s using JavaScript), and I have about 5 tabs open with it operating.

Here are my System Preferences > Battery settings:

Turn display off after: 15 mins.

Slightly dim the display while on battery power: selected

Enable Power Nap while on battery power: Not selected

Automatic graphics switching: selected

Optimize video streaming while on battery: selected

Optimized battery charging: selected

Low power mode: selected

Under “Battery Health…” Manage battery longevity: selected

That’s the best I can give you right now.

Expected result:

When I close the lid on my MacBook Pro, I expect it to enter sleep mode.

Brave Version( check About Brave):

1.39.111

Additional Information:

I am using macOS Monterey, Version 12.4.

@mmiller

My recommendation, is to Exit / Quit all Internet-communicating applications that are in your /Applications/ folder . . . before putting a desktop, laptop, notebook computer to sleep.

Especially Exit / Quit all Chromium-based Internet browsers.

I noticed this today when I had a tab open in Reddit with an embedded video that had finished playing. When I closed the tab with the video, the Preventing Sleep property changed to No for Brave.

I reopened the page. Preventing Sleep wasn’t Yes until I clicked play on the video. When clicking pause Preventing Sleep goes away.

I can’t say for sure if it is related to the media playing as there is a bit of a delay between changing the playback state and Preventing Sleep toggling. Maybe something to check.