-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a way to clear player jobs for when we need to flush the queue.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Flare\Models\CapitalCityBuildingQueue; | ||
use App\Flare\Models\CapitalCityResourceRequest; | ||
use App\Flare\Models\CapitalCityUnitQueue; | ||
use App\Flare\Models\CharacterAutomation; | ||
use Illuminate\Console\Command; | ||
|
||
class ClearPlayersJobs extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'clear:players-jobs'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command descriptionClear specific player jobs when the queue is acting up'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
CharacterAutomation::chunkById(100, function ($characterAutomations) { | ||
foreach ($characterAutomations as $characterAutomation) { | ||
$characterAutomation->delete(); | ||
} | ||
}); | ||
|
||
CapitalCityUnitQueue::truncate(); | ||
CapitalCityBuildingQueue::truncate(); | ||
CapitalCityResourceRequest::truncate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters