notify-rs/notify

My program stops getting events after some time

ShayBox opened this issue · 2 comments

I use notify-rs in my VRC-LOG project here and here

I'm on Windows 11 23H2 using the latest version of notify-rs and my program stops getting events after about 10–30 minutes, do you know what might be causing this? This has been a problem since the start of my project, it's not new.

I tried adding prints to the callbacks, but they just stopped getting events altogether.

EDIT: Though I ignore send errors now, I previously unwrapped and never found an exception.

0xpr03 commented

Looks like a duplicate of #482. You have to keep the watcher around. Dropping it like here stops the event loop. See also variable scopes for why your watcher is gone at the end of that scope/function.

Ah, that makes sense... I discovered the same thing about the channels, but didn't occur to me the watcher is the same. 🤦 Thank you