Skip to content

Commit

Permalink
Added a way to clear player jobs for when we need to flush the queue.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKyle committed Nov 28, 2024
1 parent aeda194 commit c9987d0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
42 changes: 42 additions & 0 deletions app/Console/AfterDeployment/ClearPlayersJobs.php
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();
}
}
2 changes: 2 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use App\Console\AfterDeployment\RebalanceStatReducingAffixes;
use App\Console\AfterDeployment\RebalanceTrinkets;
use App\Console\AfterDeployment\ReduceCharacterBaseModifiersForReincarnation;
use App\Console\Commands\ClearPlayersJobs;
use App\Console\DevelopmentCommands\AssignTopEndGearToPlayer;
use App\Console\DevelopmentCommands\CompleteGuideQuestForCharacter;
use App\Console\DevelopmentCommands\CreateCharacter;
Expand Down Expand Up @@ -68,6 +69,7 @@ public function register(): void
RebalanceSkillReductionAffixes::class,
RebalanceIrresistableDamageAffixes::class,
RebalanceTrinkets::class,
ClearPlayersJobs::class,

// Development Commands:
CreateCharacter::class,
Expand Down

0 comments on commit c9987d0

Please sign in to comment.