qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.5k stars 4k forks source link

Avoid duplicate error notifications output by grouping them #19951

Open madidier opened 1 year ago

madidier commented 1 year ago

qBittorrent & operating system versions

qBittorrent: 4.6.0 x64 Operating system: Windows 11 Pro 22H2 (10.0.22621)

What is the problem?

I'm currently having some hardware or firmware issue and the hard drive that stores my torrent files sometimes randomly disconnects only to pop back up a fraction of a second later. When that happens, qBittorrent generates a cascade of i/o error notifications and keeps doing so for a while, sometimes a few minutes. On windows 11, it usually makes it impossible to open qBittorrent from the system tray because the stream of notifications keeps getting in the way.

Windows gives me the option of completely silencing qBittorrent's notifications, but I'd rather avoid resorting to that. It would be much better to have qBittorrent either throttle notifications and group then when a lot of i/o errors occur at once or to update the first error notification that was raised. Something like "15 i/o errors occurred in the last 30 seconds" would work for me.

Steps to reproduce

This should be easily reproducible by having several torrent file active while forcefully removing the hard drive that stores the downloads.

Additional context

No response

Log(s) & preferences file(s)

No response

luzpaz commented 1 year ago

From #12968

Moving, Checking, Checking resume data (grouped with checking?), I/O Errors (group with Errored?)
1k+ torrents and trying to watch the windows notification for the I/O error to then sort it to find it is easily fixed with grouping those in the errored i would think? The others are just common things that happen so it would be helpful for those as well.

rostebafyu commented 3 days ago

Not one of the official devs but I was interested in this too and decided to poke around in the code a bit. My initial research suggests that the notification messages get printed by DesktopIntegration->showNotification, which in turn passes the final text on to either Mac utilities, DBUS, or QSystemTrayIcon->showMessage as appropriate.

I'm not familiar with how notification grouping is generally done in any app / with any of these approaches (I haven't played with either C++ or QT framework much). Will have to play around to see if it is even possible. But from my initial reading of QSystemTrayIcon docs, the impression I am getting is that it isn't something supported by the underlying QT function, so keeping track of grouping / etc would need to be done on the Qbittorrent side of things (e.g. wouldn't be as simple as passing a flag ... at minimum, would likely require keeping track of message text in some kind of list / array / cache / etc somewhere then comparing based on that whether current text should be printed or not)..

Not committing to anything yet (read: if anyone is willing and able then don't wait on me). But if I get some free time and am able to figure out anything concrete, will try to share. I can say right off the bat that I have zero Mac products and even less interest in getting any, so even if I managed to somehow pull it off, would probably need advice for how to handle that part of it unless the team is ok me just adding the cross-platform stuff + linux support (and maybe windows if i can get a win11 vm setup) and then leaving the rest for someone else to implement/test the mac-specific stuff.