diff --git a/app/Classes/File/Mail.php b/app/Classes/File/Mail.php index eb43d49..dffdcfd 100644 --- a/app/Classes/File/Mail.php +++ b/app/Classes/File/Mail.php @@ -58,7 +58,7 @@ final class Mail extends Send if ($successful) { $this->complete = TRUE; - Log::debug(sprintf('%s:- Successful close for [%d] - updating [%d] records.',self::LOGKEY,$this->type,$this->dbids->count()),['dbids'=>$this->dbids,'authd'=>$node->aka_remote_authed->pluck('id')]); + Log::info(sprintf('%s:- Successful close for [%d] - updating [%d] records.',self::LOGKEY,$this->type,$this->dbids->count()),['dbids'=>$this->dbids,'authd'=>$node->aka_remote_authed->pluck('id')]); // Update netmail table if (($this->type === Send::T_NETMAIL) diff --git a/app/Jobs/MailSend.php b/app/Jobs/MailSend.php index f5504a4..7886d78 100644 --- a/app/Jobs/MailSend.php +++ b/app/Jobs/MailSend.php @@ -50,7 +50,6 @@ class MailSend #implements ShouldQueue ->join('domains',['domains.id'=>'zones.domain_id']) ->groupBy('a.system_id','a.id','a.zone_id','addresses.region_id','a.host_id','a.node_id','a.point_id','addresses.hub_id','addresses.role') ->with(['system','zone.domain']) - ->dontCache() ->get(); // Return the system we poll diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index 333b5f3..aa4fb9c 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -233,13 +233,6 @@ class MessageProcess implements ShouldQueue // Check for duplicate messages // FTS-0009.001 if ($this->mo->msgid) { - $o = ($x=Echomail::where('msgid',$this->mo->msgid) - ->where('fftn_id',$this->mo->fftn_id) - ->where('datetime','>=',$this->mo->datetime->clone()->subYears(3)) - ->where('datetime','<=',$this->mo->datetime) - ->dontCache()) - ->single(); - Log::debug(sprintf('%s:- Checking for duplicate from host id [%d], with msgid [%s] between [%s] and [%s].', self::LOGKEY, $this->mo->fftn_id, @@ -248,6 +241,11 @@ class MessageProcess implements ShouldQueue $this->mo->datetime, )); + $x = Echomail::where('msgid',$this->mo->msgid) + ->where('fftn_id',$this->mo->fftn_id) + ->where('datetime','>=',$this->mo->datetime->clone()->subYears(3)) + ->where('datetime','<=',$this->mo->datetime); + if ($x->count()) { // @todo Actually update seenby Log::alert(sprintf('%s:! Duplicate echomail (%s) in [%s] from (%s) [%s] to (%s) - ignoring.', @@ -270,7 +268,6 @@ class MessageProcess implements ShouldQueue $o = Echomail::where('msg_crc',$xx=md5($this->mo->msg_crc)) ->where('fftn_id',$this->mo->fftn_id) ->where('datetime','>',Carbon::now()->subWeek()) - ->dontCache() ->get(); if ($o->count()) diff --git a/app/Models/Address.php b/app/Models/Address.php index 27ba430..7dd7cfd 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Log; use App\Classes\FTN\{Message,Packet}; use App\Exceptions\InvalidFTNException; -use App\Traits\ScopeActive; +use App\Traits\{QueryCacheableConfig,ScopeActive}; /** * This represents an FTN AKA. @@ -48,7 +48,7 @@ use App\Traits\ScopeActive; class Address extends Model { - use ScopeActive,SoftDeletes; + use ScopeActive,SoftDeletes,QueryCacheableConfig; private const LOGKEY = 'MA-'; @@ -469,7 +469,8 @@ class Address extends Model ->whereNotNull('export_at') ->whereNull('sent_at') ->whereNull('echomails.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } public function scopeUncollectedEchomailTotal($query) @@ -503,7 +504,8 @@ class Address extends Model ->whereNotNull('export_at') ->whereNull('sent_at') ->whereNull('files.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } public function scopeUncollectedFilesTotal($query) @@ -535,7 +537,8 @@ class Address extends Model ->whereNull('sent_pkt') ->whereNull('sent_at') ->whereNull('netmails.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } /** diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index edff859..297d3b2 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -13,11 +13,11 @@ use App\Classes\FTN\Message; use App\Events\Echomail as EchomailEvent; use App\Interfaces\Packet; use App\Models\Casts\{CompressedStringOrNull,CollectionOrNull,UTF8StringOrNull}; -use App\Traits\{MessageAttributes,MsgID,ParseAddresses,QueryCacheableConfig}; +use App\Traits\{MessageAttributes,MsgID,ParseAddresses}; final class Echomail extends Model implements Packet { - use SoftDeletes,MessageAttributes,MsgID,ParseAddresses,QueryCacheableConfig; + use SoftDeletes,MessageAttributes,MsgID,ParseAddresses; private const LOGKEY = 'ME-'; public const UPDATED_AT = NULL; @@ -291,7 +291,6 @@ final class Echomail extends Model implements Packet return $this->belongsToMany(Address::class,'echomail_seenby') ->select(['addresses.id','zone_id','host_id','node_id']) ->withPivot(['export_at','sent_at','sent_pkt']) - ->dontCache() ->FTN2DOrder(); } diff --git a/app/Traits/QueryCacheableConfig.php b/app/Traits/QueryCacheableConfig.php index 4c4dcae..a53e659 100644 --- a/app/Traits/QueryCacheableConfig.php +++ b/app/Traits/QueryCacheableConfig.php @@ -11,7 +11,7 @@ trait QueryCacheableConfig { use QueryCacheable; - public $cacheFor = 900; // cache time, in seconds + public $cacheFor = 30; // cache time, in seconds protected static $flushCacheOnUpdate = TRUE; public $cacheDriver = 'memcached'; } \ No newline at end of file