mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-28 14:57:22 +08:00
fix: avoid getCurrentCommit on cache hit
This commit is contained in:
@@ -24,8 +24,10 @@ class UpdateService
|
|||||||
*/
|
*/
|
||||||
public function getCurrentVersion(): string
|
public function getCurrentVersion(): string
|
||||||
{
|
{
|
||||||
$date = Cache::get(self::CACHE_VERSION_DATE, date('Ymd'));
|
$date = Cache::get(self::CACHE_VERSION_DATE) ?? date('Ymd');
|
||||||
$hash = Cache::get(self::CACHE_VERSION, $this->getCurrentCommit());
|
$hash = Cache::rememberForever(self::CACHE_VERSION, function () {
|
||||||
|
return $this->getCurrentCommit();
|
||||||
|
});
|
||||||
return $date . '-' . $hash;
|
return $date . '-' . $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +51,9 @@ class UpdateService
|
|||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
Cache::forever(self::CACHE_VERSION_DATE, date('Ymd'));
|
Cache::forever(self::CACHE_VERSION_DATE, date('Ymd'));
|
||||||
Cache::forever(self::CACHE_VERSION, $this->getCurrentCommit());
|
$fallbackHash = $this->getCurrentCommit();
|
||||||
Log::info('Version cache updated (fallback): ' . date('Ymd') . '-' . $this->getCurrentCommit());
|
Cache::forever(self::CACHE_VERSION, $fallbackHash);
|
||||||
|
Log::info('Version cache updated (fallback): ' . date('Ymd') . '-' . $fallbackHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkForUpdates(): array
|
public function checkForUpdates(): array
|
||||||
|
|||||||
Reference in New Issue
Block a user