Increase cleanup timout for minecraft access tokens

This commit is contained in:
ErickSkrauch 2019-09-01 23:16:13 +03:00
parent 29fc267148
commit 6c4ce8cb8d

View File

@ -1,6 +1,7 @@
<?php
namespace console\controllers;
use Carbon\Carbon;
use common\models\AccountSession;
use common\models\EmailActivation;
use common\models\MinecraftAccessKey;
@ -32,7 +33,7 @@ class CleanupController extends Controller {
public function actionMinecraftSessions(): int {
$expiredMinecraftSessionsQuery = MinecraftAccessKey::find()
->andWhere(['<', 'updated_at', time() - 1209600]); // 2 weeks
->andWhere(['<', 'updated_at', Carbon::now()->subMonths(3)->getTimestamp()]);
foreach ($expiredMinecraftSessionsQuery->each(100, Yii::$app->unbufferedDb) as $minecraftSession) {
/** @var MinecraftAccessKey $minecraftSession */