diff --git a/app/Jobs/ProcessStructureJob.php b/app/Jobs/ProcessStructureJob.php index c9cd1bc14..6dd91780f 100644 --- a/app/Jobs/ProcessStructureJob.php +++ b/app/Jobs/ProcessStructureJob.php @@ -69,5 +69,8 @@ class ProcessStructureJob implements ShouldQueue $sHelper = new StructureHelper($this->charId, $this->corpId); $sHelper->ProcessStructure($this->structure); + + //After the job is completed, delete the job + $this->delete(); } } diff --git a/app/Library/Structures/StructureHelper.php b/app/Library/Structures/StructureHelper.php index 9538a318b..b175df950 100644 --- a/app/Library/Structures/StructureHelper.php +++ b/app/Library/Structures/StructureHelper.php @@ -42,6 +42,28 @@ class StructureHelper { $this->corpId = $corp; } + public function GetStructuresByPage($page) { + // Disable all caching by setting the NullCache as the + // preferred cache handler. By default, Eseye will use the + // FileCache. + $configuration = Configuration::getInstance(); + $configuration->cache = NullCache::class; + + //Setup the esi authentication container + $config = config('esi'); + //Get the refresh token from the database + $token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']); + $authentication = new EsiAuthentication([ + 'client_id' => $config['client_id'], + 'secret' => $config['secret'], + 'refresh_token' => $token[0]->refresh_token, + ]); + //Setup the ESI variable + $esi = new Eseye($authentication); + + + } + public function ProcessStructure($structure) { //Setup the esi authentication container $config = config('esi'); @@ -67,32 +89,6 @@ class StructureHelper { } - public function GetListOfStructures() { - //Setup the esi authentication container - $config = config('esi'); - //Get the refresh token from the database - $token = EsiToken::where(['character_id' => $this->charId])->get(['refresh_token']); - $authentication = new EsiAuthentication([ - 'client_id' => $config['client_id'], - 'secret' => $config['secret'], - 'refresh_token' => $token[0]->refresh_token, - ]); - - $esi = new Eseye($authentication); - - try { - $structures = $esi->page($this->page) - ->invoke('get', '/corporations/{corporation_id}/structures/', [ - 'corporation_id' => $this->corpId, - ]); - } catch (RequestFailedException $e) { - Log::critical("Failed to get structure list."); - $structures = null; - } - - return $structures; - } - private function GetSolarSystemName($systemId) { //Setup the esi authentication container $config = config('esi');