Browse Source

Cleanup Infos from the DB not updated after two months, they will be refresh if required

pull/1443/head
Timothée Jaussoin 5 months ago
parent
commit
7694c57e78
  1. 18
      src/Movim/Daemon/Core.php

18
src/Movim/Daemon/Core.php

@ -17,6 +17,7 @@ use Movim\Daemon\Session;
use App\Session as DBSession;
use App\EncryptedPassword;
use App\PushSubscription;
use App\Info;
use Minishlink\WebPush\VAPID;
class Core implements MessageComponentInterface
@ -218,11 +219,28 @@ class Core implements MessageComponentInterface
}
$this->cleanupDBSessions();
});
$this->cleanupEncryptedPasswords();
$this->cleanupPushSubscriptions();
$this->cleanupInfos();
$this->loop->addPeriodicTimer(60 * 60 * 24, function () {
$this->cleanupEncryptedPasswords();
$this->cleanupPushSubscriptions();
$this->cleanupInfos();
});
}
/**
* @desc Delete infos that were pulled after two months, they will be refreshed if required
*/
private function cleanupInfos()
{
Info::where('updated_at', '<', date(MOVIM_SQL_DATE, time() - (60 * 60 * 24 * 30 * 2)))
->delete();
}
private function cleanupDBSessions()
{
DBSession::where('active', false)

Loading…
Cancel
Save