mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Handle differently when trying to update geolocation and already in progress
This commit is contained in:
@@ -56,6 +56,11 @@ class DownloadGeoLiteDbCommand extends Command implements GeolocationDownloadPro
|
||||
return ExitCode::EXIT_WARNING;
|
||||
}
|
||||
|
||||
if ($result === GeolocationResult::UPDATE_IN_PROGRESS) {
|
||||
$this->io->warning('A geolocation db is already being downloaded by another process.');
|
||||
return ExitCode::EXIT_WARNING;
|
||||
}
|
||||
|
||||
if ($this->progressBar === null) {
|
||||
$this->io->info('GeoLite2 db file is up to date.');
|
||||
} else {
|
||||
|
||||
@@ -77,6 +77,7 @@ class DownloadGeoLiteDbCommandTest extends TestCase
|
||||
#[Test]
|
||||
#[TestWith([GeolocationResult::LICENSE_MISSING, 'It was not possible to download GeoLite2 db'])]
|
||||
#[TestWith([GeolocationResult::MAX_ERRORS_REACHED, 'Max consecutive errors reached'])]
|
||||
#[TestWith([GeolocationResult::UPDATE_IN_PROGRESS, 'A geolocation db is already being downloaded'])]
|
||||
public function warningIsPrintedForSomeResults(GeolocationResult $result, string $expectedWarningMessage): void
|
||||
{
|
||||
$this->dbUpdater->expects($this->once())->method('checkDbUpdate')->withAnyParameters()->willReturn($result);
|
||||
|
||||
Reference in New Issue
Block a user