Added a retry mechanism when scanning fails, to prevent waiting unnecessarily long for the next scan.
This usually happens when closing and reopening the applet, or when a scan was started by another component before opening the applet.
jgrulich | |
ngraham |
Plasma |
Added a retry mechanism when scanning fails, to prevent waiting unnecessarily long for the next scan.
This usually happens when closing and reopening the applet, or when a scan was started by another component before opening the applet.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
I would keep the 15s interval, everyone does 15s. Also from what I have read, every scan drops your connection for a while, which might be a problem for bad wifi drivers, where the scan can take 15+ seconds so doing this more often is not a good idea. Other thing I would change is to try to repeat the scan if it fails only for the first time (when you open the applet), then I don't think it's necessary to keep spamming NetworkManager with our requests.
Everyone using 15 seconds for a timeout doesn't mean it's good for the users... Anyways, why shouldn't we be doing an attempt every 2 seconds? that's not a lot. I could do two things instead:
Other thing I would change is to try to repeat the scan if it fails only for the first time
then I don't think it's necessary to keep spamming NetworkManager with our requests.
Maybe not necessary, but I don't think it's an issue either.
The return is very early on the NM side, it won't actually spend time doing anything.
DBus overhead is insignificant when doing something every second.
I think it's reasonable enough and also as I mentioned above, wifi scanning drops your connection for a while, there is no reason to drop it more often, especially when we will have a fresh scan as soon as possible.
Also see: https://blogs.gnome.org/dcbw/2016/05/16/networkmanager-and-wifi-scans/
Anyways, why shouldn't we be doing an attempt every 2 seconds? that's not a lot. I could do two things instead:
I didn't mean we shouldn't be doing an attempt every 2 seconds, I meant that we should go through this retry logic only in case of initial scan, but keep it that way. Just set the interval back to 15s.
applet/contents/ui/main.qml | ||
---|---|---|
78 | Since this is just one line function, you can use handler.requestScan() directly as before. |
applet/contents/ui/main.qml | ||
---|---|---|
78 | I did it for consistency, so in both files there's only one action. It's also useful for debugging. |
applet/contents/ui/main.qml | ||
---|---|---|
78 | It would still be one action even if you call "handler.requestScan()" instead of adding additional unnecessary layer. |