Change default internal caching to off, and added test to make sure things are cached if on. More debugging with packet name for netmails
This commit is contained in:
parent
63e3397aee
commit
3dc18a3f1f
@ -58,7 +58,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
public Collection $messages; // Messages in the Packet
|
||||
public Collection $errors; // Messages that fail validation
|
||||
private string $name; // Packet name
|
||||
public bool $use_cache = TRUE; // Use a cache for messages.
|
||||
public bool $use_cache = FALSE; // Use a cache for messages.
|
||||
private int $index; // Our array index
|
||||
|
||||
/**
|
||||
@ -124,7 +124,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
* @throws InvalidPacketException
|
||||
*/
|
||||
|
||||
public static function process(mixed $f,string $name,int $size,System $system=NULL,bool $use_cache=TRUE): self
|
||||
public static function process(mixed $f,string $name,int $size,System $system=NULL,bool $use_cache=FALSE): self
|
||||
{
|
||||
Log::debug(sprintf('%s:+ Opening Packet [%s] with size [%d]',self::LOGKEY,$name,$size));
|
||||
|
||||
@ -523,7 +523,9 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
|
||||
if ($this->use_cache) {
|
||||
$key = urlencode($msg->msgid ?: sprintf('%s %s',$msg->fftn,Carbon::now()->timestamp));
|
||||
Cache::forever($key,serialize($msg));
|
||||
if (! Cache::forever($key,serialize($msg)))
|
||||
throw new \Exception(sprintf('Caching failed for key [%s]?',$key));
|
||||
|
||||
$this->messages->push($key);
|
||||
|
||||
} else {
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
use App\Classes\File;
|
||||
use App\Classes\FTN\Packet;
|
||||
@ -45,7 +44,7 @@ class PacketProcess extends Command
|
||||
// @todo Quick check that the packet should be processed by us.
|
||||
// @todo validate that the packet's zone is in the domain.
|
||||
|
||||
$this->info(sprintf('Processing message from [%s] with msgid [%s]',$msg->fboss,$msg->msgid));
|
||||
$this->info(sprintf('Processing message from [%s] with msgid [%s] in (%s)',$msg->fboss,$msg->msgid,$f->pktName()));
|
||||
|
||||
// Dispatch job.
|
||||
Job::dispatchSync($msg,$f->pktName(),$this->option('nobot'));
|
||||
|
@ -41,6 +41,13 @@ class MessageProcess implements ShouldQueue
|
||||
|
||||
// If we are a netmail
|
||||
if ($this->msg->isNetmail()) {
|
||||
Log::info(sprintf('%s:Processing Netmail [%s] to (%s) [%s] from (%s) [%s].',
|
||||
self::LOGKEY,
|
||||
$this->msg->msgid,
|
||||
$this->msg->user_to,$this->msg->tftn,
|
||||
$this->msg->user_from,$this->msg->fftn,
|
||||
));
|
||||
|
||||
// @todo Enable checks to reject old messages
|
||||
// @todo Enable checks to reject duplicate
|
||||
// @todo Enable checks to see if this is a file request or file send
|
||||
|
Loading…
Reference in New Issue
Block a user