/** * Cleans up any stalled deployments in the database. * * @tpdp Maybe readd pending to the queue if possible? * @return void */ public function cleanupDeployments() { // Mark any pending steps as cancelled ServerLog::where('status', '=', ServerLog::PENDING)->update(['status' => ServerLog::CANCELLED]); // Mark any running steps as failed ServerLog::where('status', '=', ServerLog::RUNNING)->update(['status' => ServerLog::FAILED]); // Mark any running/pending deployments as failed Deployment::whereIn('status', [Deployment::DEPLOYING, Deployment::PENDING])->update(['status' => Deployment::FAILED]); // Mark any deploying/pending projects as failed Project::whereIn('status', [Project::DEPLOYING, Project::PENDING])->update(['status' => Project::FAILED]); }