diff --git a/app/Jobs/ImportHubDataJob.php b/app/Jobs/ImportHubDataJob.php index c429512..669a31b 100644 --- a/app/Jobs/ImportHubDataJob.php +++ b/app/Jobs/ImportHubDataJob.php @@ -51,6 +51,9 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue $this->importMods(); $this->importModVersions(); + // Remove mods that are no longer on the hub. + $this->removeDeletedMods(); + // Ensure that we've disconnected from the Hub database, clearing temporary tables. DB::connection('mysql_hub')->disconnect(); @@ -965,6 +968,19 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue }, 'versionID'); } + /** + * Remove mods that are no longer on the Hub. + */ + private function removeDeletedMods(): void + { + $mods = Mod::select('hub_id')->all(); + foreach ($mods as $mod) { + if (DB::connection('mysql_hub')->table('filebase1_file')->where('fileID', $mod->hub_id)->doesntExist()) { + $mod->delete(); + } + } + } + /** * The job failed to process. */ diff --git a/config/horizon.php b/config/horizon.php index b3a3771..f8cde95 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -207,7 +207,7 @@ return [ 'maxJobs' => 0, 'memory' => 256, 'tries' => 1, - 'timeout' => 1500, // 25 Minutes + 'timeout' => 2700, // 45 Minutes 'nice' => 0, ], ],