resourceloader: Avoid opening a connection to master when not needed

SqlModuleDependencyStore::storeMulti() gets called unconditionally by
RL::saveModuleDependenciesInternal() and lots of time with empty value,
this opens a master connection in GET requests where it's not needed.
Let's remove that for now.

More info in I462055ce9caa

Change-Id: I6f618d396d64c687ba6cc68cfa99bf3f4327e798
This commit is contained in:
Amir Sarabadani 2021-05-26 20:53:57 +02:00
parent 575435174b
commit 663e4ce6bb

View file

@ -69,6 +69,12 @@ class SqlModuleDependencyStore extends DependencyStore {
}
public function storeMulti( $type, array $dataByEntity, $ttl ) {
// Avoid opening a master connection when it's not needed.
// ResourceLoader::saveModuleDependenciesInternal calls this method unconditionally
// with empty values most of the time.
if ( !$dataByEntity ) {
return;
}
try {
$dbw = $this->getMasterDb();