Bug 423723

Summary: Subjectively speaking, Discover takes too long to be useful after it starts up
Product: [Applications] Discover Reporter: Michael <kde>
Component: discoverAssignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, nate, sephiroth_pk
Priority: HI    
Version: 5.19.2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=400808
Latest Commit: Version Fixed In: 5.20

Description Michael 2020-07-01 03:59:56 UTC
SUMMARY

I realize this is subjective, but I and my friend are reluctant to use Discover. Because when it starts, we have to wait for awhile before Discover can be usable. 

I have a friend who is not an expert who uses Kubuntu 18.04 and 20.04 on his computers and he explicitly doesn't like to use Discover because, as he says, "it's too slow". So he prefers to use Muon. I prefer to use anything else because of the lag before Discover becomes useful. I have a laptop running KDE neon with a SSD, so I'm used to things being responsive.

Similarly, it's frustrating because I know that my computer has *already* done an "apt update" because the notifier is telling me that there are system updates. Then I click on the notifier in the system tray, and Discover opens, but it looks like it's doing *another* "apt update" before it wants to show me the updates that it already knows I need. Which contributes to the waiting/unresponsiveness/frustration. 

I have a slow internet connection, while my friend has a very fast connection, and neither make a difference.

I don't know what the solution to this is. Maybe if the computer has just done an update, then don't do another update when Discover starts...? Or have a message saying "Discover hasn't been refreshed in xxx days. Click here to refresh its contents."?? So that way Discover can be immediately useful.


STEPS TO REPRODUCE

1. Launch Discover
2. Wait
3. Wait
4. Wait
5. Wait
6. Wait
7. Is it usable yet? No? Wait


DESIRED RESULT

Discover is usable right after it appears onscreen. Even if its contents aren't valid up to that moment.


SOFTWARE/OS VERSIONS

Hard drive: SSD
Network connection: both slow and fast
Operating System: KDE neon 5.19
KDE Plasma Version: 5.19.2
KDE Frameworks Version: 5.71.0
Qt Version: 5.14.2
Kernel Version: 5.3.0-61-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-2467M CPU @ 1.60GHz
Memory: 7.7 GiB of RAM
Comment 1 Nate Graham 2020-07-02 00:53:44 UTC
I have a rough idea of what you mean, but can you clarify what you mean by "useful?" What doesn't work until after you wait a while?
Comment 2 Michael 2020-07-04 01:36:38 UTC
Okay, what do I mean by "useful"? I mean that Discover is in a waiting state when it appears, always. How long that waiting state is, is variable. 

I boot my laptop. 3 minutes after the update notifier appears in the system tray, I click on the update notifier icon and Discover launches. A 27 seconds wait ensues, where Discover says "Fetching updates...". Yet my computer had just finished the fetching updates process a few minutes before. Why wait in this instance?

Instead of clicking the "Update All" button at the top of Discover, I close the app. I click the update notifier once again to measure the wait. Discover launches. It takes 5 seconds of looking at the "Fetching updates..." text before I can do something.

Every time I launch Discover regularly from the Kickoff menu on my SSD-backed system, Discover takes 5 seconds to display "Loading" with the spinning arrow before I could do anything.

On the other hand, I launch Muon and all the packages appeared instantly when the GUI showed up.

My point is that the variable waiting aspect of Discover makes me not want to reach for it, even though it is an excellently engineered piece of software in every other respect.
Comment 3 Michael 2020-07-05 01:02:40 UTC
A few more thoughts....

I notice that Discover has two modes: an update mode, and a store mode. 

Launching Discover into the update mode seems to have the longest and most varied delay before I can do something with Discover. Today it was 30 seconds exactly from the time its window appeared to when I could click Update All. 

Launching Discover into the store mode is shorter in terms of waiting, on average of 5 seconds for me on my SSD-backed system. It might be significantly longer on a HDD-backed machine. Regardless, it's still time staring at a window wondering when I can be productive.

It would be great if the wait in these two modes were eliminated. It might take some chewing on the design to work it out, but I think it would be great for the perception that "KDE is responsive" as well as "KDE is highly configurable".
Comment 4 Nate Graham 2020-07-07 21:42:48 UTC
Thanks, that's helpful. I can reproduce the long delay in checking for updates, which has annoyed me for quite some time as well. I just timed Discover vs running `pkcon refresh` on the command line; Discover took 26 seconds, while `pkcon refresh took 6 seconds`.

Resolving the discrepancy will probably reveal the underlying issue causing the delay at startup.
Comment 5 Michael 2020-07-08 21:27:43 UTC
I wouldn't be surprised if the extra time difference was because Discover is also refreshing snap and flatpak repos. I don't mind that it does this. 

I do mind that just 5 seconds after the system displays the update notifier icon, I click on it, and then Discover decides it needs to refresh everything all over again. But I'll be curious to hear what you find.
Comment 6 Michael 2020-07-11 22:29:06 UTC
Two new modes where Discover takes a long time...

If I go to Dolphin, left-click on the space information indicator in the lower-right-hand corner, a menu appears, choose More -> KDiskFree -> Install. Discover launches and takes 43 seconds to become usable (first attempt) or 6 seconds (second attempt). It's unclear to me why the first invocation was so long compared to the second invocation.

If I go to Kickoff, find an app I don't want, right-click on it, select "Uninstall of Manage Add-Ons", then Discover launches and takes 6 seconds to be usable.
Comment 7 Bug Janitor Service 2020-07-22 14:03:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/15
Comment 8 Aleix Pol 2020-07-22 22:47:51 UTC
Git commit 3e85afeb8e1d52264262d8093b27da52e58bf1d7 by Aleix Pol.
Committed on 22/07/2020 at 22:39.
Pushed by apol into branch 'master'.

pk: only resolve packages as they're offered from a ::search call

It should make the resolve calls a bit faster since we are not
processing all packages at startup. It does increase the calls we make
though.

M  +1    -1    libdiscover/backends/PackageKitBackend/CMakeLists.txt
R  +34   -6    libdiscover/backends/PackageKitBackend/PKResolveTransaction.cpp [from: libdiscover/backends/PackageKitBackend/TransactionSet.cpp - 053% similarity]
R  +15   -6    libdiscover/backends/PackageKitBackend/PKResolveTransaction.h [from: libdiscover/backends/PackageKitBackend/TransactionSet.h - 080% similarity]
M  +89   -54   libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
M  +8    -3    libdiscover/backends/PackageKitBackend/PackageKitBackend.h
M  +11   -0    libdiscover/utils.h

https://invent.kde.org/plasma/discover/commit/3e85afeb8e1d52264262d8093b27da52e58bf1d7
Comment 9 Riccardo Robecchi 2020-07-25 08:28:48 UTC
This also seems to be related to https://bugs.kde.org/show_bug.cgi?id=400808.