Jobs setup
This commit is contained in:
@ -154,7 +154,6 @@ class Messages extends Base
|
||||
$message->doesHaveValidAttachments();
|
||||
}
|
||||
}
|
||||
error_log(json_encode(compact('message')).PHP_EOL,3,'/logs/debug');
|
||||
$this->getRepository()->save($message);
|
||||
return true;
|
||||
} catch (PDOException $e) {
|
||||
@ -196,20 +195,7 @@ class Messages extends Base
|
||||
$registered = $this->getMailboxes()->getRegistered();
|
||||
foreach ($registered as $mailbox) {
|
||||
if (!$this->getMailboxes()->isUpdated($mailbox)) {
|
||||
$this->logger->info("Updating messages from {$mailbox->getName()}");
|
||||
$this->grab($mailbox->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
public function checkSchedule(): void
|
||||
{
|
||||
$messages = $this->getRepository()->fetchAll();
|
||||
foreach ($messages as $message) {
|
||||
if ($message->hasAttachments() and $message->hasValidAttachments() and !$message->hasDownloadedAttachments() and !$message->hasScheduledDownloads()) {
|
||||
if ($this->getJobsService()->schedule($message->getId())) {
|
||||
$message->doesHaveDownloadedAttachments();
|
||||
$this->getRepository()->save($message);
|
||||
}
|
||||
$this->getJobsService()->queue('messages:grab', [$mailbox->getId()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user