Make it less likely to run into a "Query overheated" error in the Feed Transaction Log by not querying data of applications that got uninstalled and thus are not accessible anymore anyway.
Mitigates T15642
Differential D25501
Feed: Do not query and display data of uninstalled applications aklapper on Dec 25 2023, 21:20. Authored by Tags None Referenced Files
Details
Make it less likely to run into a "Query overheated" error in the Feed Transaction Log by not querying data of applications that got uninstalled and thus are not accessible anymore anyway. Mitigates T15642
Diff Detail
Event TimelineComment Actions There might be room for performance improvements - currently for each $query, PhabricatorApplication::isClassInstalledForViewer is called again though some queries share the same application. Comment Actions This also needs rework because I still get a Query overheated when not being logged in and going to http://phorge.localhost/feed/transactions/query/all/
Comment Actions Are there any feed transactions that are visible to logged out users? Maybe that feed page should just 404 when logged out? Comment Actions Yes, basically all. See https://we.phorge.it/feed/transactions/query/advanced/ in a private browser window Comment Actions Fix D25501#14443: Do not show an "Query overheated" error when the user is anonymous and the application has been uninstalled Comment Actions In what case, a class can be installed "for the viewer", but generally uninstalled? Edited: sorry I get this. I think that application "Visible to: (Registered) Users" triggers the "not installed". Comment Actions It makes sense thanks. Minor note: If the application is not visible (false), there is no need to also check for isClassInstalled() (that may return true). This can also lead to a situation where the app is not visible to that user, but the query is shown. Maybe we can simplify things introducing a commodity "if viewer exists" method like: // Remove TransactionQuery classes of uninstalled apps. Increases query // performance and decreases likeliness of an "Query Overheated" error if // an app got uninstalled so data in it cannot be accessed anymore anyway. // See https://secure.phabricator.com/T13133, https://we.phorge.it/T15642 foreach ($queries as $key => $query) { $app = $query->getQueryApplicationClass(); if ($app !== null && PhabricatorApplication::isClassInstalledForViewerIfAny($app, $viewer)) { unset($queries[$key]); } } PhabricatorApplication final public static isClassInstalledForViewerIfAny( $class, PhabricatorUser $viewer) { return $viewer ? self::isClassInstalledForViewer( $class, $viewer ) : self::isClassInstalled( $class ); } Comment Actions Evaluate the suggested refactor just for readability reasons :) fine also without that. |