Ensured events triggered as a result of a new visit are never skipped

This commit is contained in:
Alejandro Celaya
2021-04-08 14:09:26 +02:00
parent 86230d9bf3
commit 7b4456e73f
6 changed files with 17 additions and 11 deletions

View File

@@ -26,11 +26,13 @@ class UpdateGeoLiteDb
$beforeDownload = fn (bool $olderDbExists) => $this->logger->notice(
sprintf('%s GeoLite2 db file...', $olderDbExists ? 'Updating' : 'Downloading'),
);
$handleProgress = function (int $total, int $downloaded, bool $olderDbExists): void {
if ($total > $downloaded) {
$messageLogged = false;
$handleProgress = function (int $total, int $downloaded, bool $olderDbExists) use (&$messageLogged): void {
if ($messageLogged || $total > $downloaded) {
return;
}
$messageLogged = true;
$this->logger->notice(sprintf('Finished %s GeoLite2 db file', $olderDbExists ? 'updating' : 'downloading'));
};