I-Dream-in-Code / kde-arch-update-plasmoid

30 stars 9 forks source link

Delay first test ? #28

Closed pix106 closed 6 years ago

pix106 commented 6 years ago

Hi, when the plasmoid loads, network may not be available yet (wifi not yet connected). Adding a "delay before first test" settings could be a good workaround. Any thoughts ? Thanks :)

I-Dream-in-Code commented 6 years ago

Was somewhat fixed bug #18

Any more delay affects refresh in settings menu

pix106 commented 6 years ago

@I-Dream-in-Code Thanks. If I got it well, last comment in the other issue tells about 1 sec delay before plasmoid start ; I'm talking about a user customizable delay to be able to delay first check for updates (not plasmoid start) for many seconds (a minute or so in my case before wifi is connected after session start). What I mean is : plasmoid starts, but does not check for updates before X seconds.

I-Dream-in-Code commented 6 years ago

I feel like a much more elegant solution is to recheck if connected to the internet again after x seconds of returning not connected then run check updates

pix106 commented 6 years ago

@I-Dream-in-Code it seems even better indeed :)

I-Dream-in-Code commented 6 years ago

I'll make a branch with the change and you can mess with the timer.

Also all you need to do is just click it and press check updates regardless of this way

I-Dream-in-Code commented 6 years ago

@pix106 I made the internetTimer branch for you.

Clone it and run install_plasmoid.sh under the internetTImer branch and see if that works for you.

Under plugin/systemcalls.cpp with the checkUpdates function you can mess with the delitime variable

pix106 commented 6 years ago

Thanks, I'll try it asap :)

pix106 commented 6 years ago

I tried : it seems plasmoid is actually running in the foreground : after the login screen, session opening is hanged with only wallpaper for 60 seconds (delitime), then session starts, and so NetworkManager can finaly try to connect to wifi.

I had seen, with regular version, that plasmoid does not seem to run in the background, as plasma is locked when checking for updates.

I-Dream-in-Code commented 6 years ago

So do you want me to change the start up time or the delitime?

pix106 commented 6 years ago

? Imho both are useless if plasmoid starts in foreground and prevents any other process to be run while waiting for "delitime" before first check.

I-Dream-in-Code commented 6 years ago

So I'll just call check if connected to internet in `main.qml' and wait 60 seconds in the foreground

The Shell hangs due to the mutex lock of readupdates

I could switch out mutex for a standard static bool and while loop it won't hang

pix106 commented 6 years ago

making it work in the background would be great :smiley: I have no clue about qt/plasma dev, i mainly do python, i'm affraid i can't help you for the dev part. Thanks for your efforts !

I-Dream-in-Code commented 6 years ago

Commit 2abcfa1b414e165109ec922c8bdea3e989295b48

replaces the mutex with boolean so it shouldn't lock.

I deleted the retry in 60 seconds part but can add it back if I need to but it shouldn't lock

I-Dream-in-Code commented 6 years ago

commit c5a4aae61e452832d755f2d63a13172eb1fb08a8 added a non-blocking 1 minuter internet recheck timer

pix106 commented 6 years ago

Thanks ! Background part seems fine, shell start is not locked anymore when session opens. It's still locking while checking for updates though (can't hide the plasmoid during check, nor do anything else with the until cheking ends).

The internet connection checker part does not seems to work, or i did not get what you wrote :) After several minutes after wifi is connected, plasmoid --stroke--still shows--/stroke-- no internet and does not do its first check. EDIT : my mistake, it actually shows "no internet" after a minute, and it showed nothing special.m before that delay. Wifi was actually connected for a few dozens seconds before plasmoid started to show "no internet".

I-Dream-in-Code commented 6 years ago

Internet check thing:

It doesn't check internet automaically constantly.

It checks it according to your refresh timer in settings, also when you login or change a setting and hit apply.

If it's not connected to waits 1 minute to test internet again.

If it's not connected within that 1 minute it returns no internet connection.

I-Dream-in-Code commented 6 years ago

0d70c20d1c372cf9bff505402b66c06bb42bb283

is an attempt to not freeze the plasmashell when locking. I have no updates right now to test and I need to probably wait a few days to get a decent number of updates for it to take x amount of secs/msecs

feel free to test it out

pix106 commented 6 years ago

Background check seems fine :) Thanks Michael ! I checked it after downgrading a package.

But i think we did not understand each other for the previous "initial check" , so i'll try to make my point clearer :

Cheers !

I-Dream-in-Code commented 6 years ago

When the plasmoid starts it checks the internet.

if no connection it rechecks in 1 minute.

If the internet is not up in that 1 minute from when the plasmoid starts it returns no internet.

So basically 1 minute is too short a time to recheck and we need a longer timer.

in /package/contents/ui/main.qml on line 63 on internetTimer branch it says 60000

play around with the number to have the appropriate recheck time

pix106 commented 6 years ago

Thanks. So i think i had understood it well, but it just does not work as intended for now : even with 120000 (2 minutes), i get the exact same result as before, it only delays the moment plasmoids shows "No internet connection"... but internet has been up for at least 1.5. minutes, so it should find internet is up and check for updates.

I-Dream-in-Code commented 6 years ago

Oh wait i see the bug

I'll fix it in a second

I-Dream-in-Code commented 6 years ago

fd340818e1f84d5db4cf1ebdcde54bac37ddabb9

it always returned no internet connection if it failed the first time because it didn't check if connected again only if the boolean was true which it always is after first check regardless if internet is up

you might still need to mess with the timer

pix106 commented 6 years ago

That's it, it works :+1: Thanks Michael :)

A suggestion for the message : "Recheck internet connection" => "No internet connection, checking again in internetTimer/1000 s" (or so...)

Do you want me to fill some other issue for the wrong number in "badge", as it is not related to the initial test issue ?

Thanks again !

I-Dream-in-Code commented 6 years ago

I'll fix it here

Is 1 minute enough time?

pix106 commented 6 years ago

For me it's enough. If it's not hard to add in plasmoid settings, every user could change the 1 minute default value to suit his needs.

I-Dream-in-Code commented 6 years ago

The reason it has to list as 1 is because it auto hides if check updates is 0

I won't show no internet otherwise

Plus it's good to notify versus just no number and no internet you can't tell

pix106 commented 6 years ago

Notifying user is always good, i agree :)

It's no big deal, but i think a number shown in a updater app badge should reflect the number of updates, not the number of messages the app it has to show. What about a "?" badge if there is no connection after internetTimer has passed ?

I-Dream-in-Code commented 6 years ago

Yeah that's an easy fix and a lot clearer

I'll work on it :)

I-Dream-in-Code commented 6 years ago

I updated the master branch to include the ? if not connected.

The previous issue is updated on master too.

You can just update the normal AUR package with an AUR helper