startTimeStamp = time(); // hourly tasks, remove all completed tasks $this->removeCompleteTasks(); $this->checkAndExpireSubscriptions(); // Store digest (daily/weekly/monthly): evaluated each hour against the configured send time. StoreDigestService::runDueDigests(); } private function removeCompleteTasks() { ScheduledAction::query()->where('status', Status::SCHEDULE_COMPLETED) ->limit(5000) ->delete(); } private function checkAndExpireSubscriptions() { if ((time() - $this->startTimeStamp) > 60) { return; } Subscription::checkAndExpireSubscriptions(); } }