Skip to content

Commit

Permalink
Fix wrong failure-msg when clearing photo-cache.
Browse files Browse the repository at this point in the history
bool GeophotoService::clearCache returns false, if any of the cleared caches was already empty.
Accordingly a failure-msg is shown in the maps-GUI.
This change makes the function always return true unless an exception occurred - then false is returned.

Signed-off-by: umgfoin <[email protected]>
  • Loading branch information
umgfoin committed Jan 17, 2025
1 parent 78a4d9b commit b473113
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/Service/GeophotoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ public function __construct(
* @return bool
*/
public function clearCache(string $userId = ''): bool {
$a = $this->photosCache->clear($userId);
$b = $this->timeOrderedPointSetsCache->clear($userId);
$c = $this->backgroundJobCache->clear('recentlyAdded:'.$userId);
$d = $this->backgroundJobCache->clear('recentlyUpdated:'.$userId);
return $a and $b and $c and $d;
try {
$this->photosCache->clear($userId);
$this->timeOrderedPointSetsCache->clear($userId);
$this->backgroundJobCache->clear('recentlyAdded:'.$userId);
$this->backgroundJobCache->clear('recentlyUpdated:'.$userId);
return true;

} catch (\Exception $e) {
return false;
}
}

/**
Expand Down

0 comments on commit b473113

Please sign in to comment.