runForever(); foreach ($this->_getDataObj()->setFilter('status', Obj::STATUS_NEW)->getListStatement() as $queue) { Mail::sendLibraryUpdatedToUser(LibraryObj::RECORD_TYPE_LIBRARY, $queue['libraryId'], $queue['vendorId']); $this->_getDataObj()->markSend(Qs_Array::map($queue, ['vendorId', 'libraryId'])); sleep(5); } $this->_getDataObj()->clearOldHistory(date('Y-m-d', strtotime('-3 months'))); } /** * @return void */ protected function runForever() { ini_set('max_execution_time', '0'); ini_set('ignore_user_abort', '1'); } }