[haiku-bugs] Re: [Haiku] #11674: [HaikuDepot] cache featured packages

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Tue, 14 Apr 2020 11:52:56 -0000

#11674: [HaikuDepot] cache featured packages
---------------------------------------+----------------------------
   Reporter:  diver                    |      Owner:  apl-haiku
       Type:  enhancement              |     Status:  assigned
   Priority:  normal                   |  Milestone:  R1
  Component:  Applications/HaikuDepot  |    Version:  R1/Development
 Resolution:                           |   Keywords:
 Blocked By:                           |   Blocking:
Has a Patch:  0                        |   Platform:  All
---------------------------------------+----------------------------
Comment (by apl-haiku):

 I have investigated the reload that is happening on each package install /
 uninstall.  This is happening because of a {{{BMessage}}} sent from the
 {{{Volume}}} class in the Package Server.  It seems to be triggering when
 there is a change in the packages and the change is sent from the message
 {{{Volume::_SetLatestState}}}.  The code of the {{{BMessage}}} is
 {{{B_PACKAGE_UPDATE}}}.

 Because when you install or uninstall a package, the
 {{{B_PACKAGE_UPDATE}}} is sent and consequently the reload of the package
 data is triggered.

 This message ends up being received in the HaikuDepot desktop application
 and it triggers the large-refresh of it's data by invoking the
 {{{MainWindow::_StartBulkLoad}}}.  I guess what happened is that this was
 fine in 2013 with a small number of packages but is slow now with a large
 number of packages.

 I assume this is implemented like this so that when a change external to
 HaikuDepot happens (for example a command line package install) then the
 HaikuDepot application is able to react and reflect this change.

 Here are some options;

 * The code in the {{{Volume}}} class could try to somehow more accurately
 describe the change and somehow convey this in the {{{BMessage}}} so that
 HaikuDepot could manipulate it's state more precisely rather than re-load.
 My guess would be that this may require a good understanding of the code
 in {{{LocalPkgDataLoadProcess}}} which probably won't be too easy.
 * New code in HaikuDepot (a new Process) could be implemented which
 diff'ed the state of the packages in the system with its internal model
 and make changes to the internal model as necessary.  At a guess, this
 would again require an in-depth understanding of what is happening in
 {{{LocalPkgDataLoadProcess}}} which doesn't seem easy.
 * HaikuDepot could stop watching the specific {{{B_PACKAGE_UPDATE}}}
 message and thereby not reflect the system's package changes.  This is a
 compromise solution, but would be a quick and easy fix.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/11674#comment:26>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: