From 53a96a8dbdb8cfca3b433a9eec6f2b4bf6300791 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 18 Oct 2021 23:10:15 +1100 Subject: [PATCH] Change dupe checking as per FTS-0009.001 --- app/Jobs/MessageProcess.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index 775b4c8..efa425f 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use Carbon\Carbon; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -142,8 +143,12 @@ class MessageProcess implements ShouldQueue ->single(); // Check for duplicate messages + // FTS-0009.001 if ($this->msg->msgid) { - $o = Echomail::where('msgid',$this->msg->msgid)->single(); + $o = Echomail::where('msgid',$this->msg->msgid) + ->where('fftn_id',($x=$this->msg->fboss_o) ? $x->id : NULL) + ->where('datetime',Carbon::now()->subYears(3)) + ->single(); if ($o) { Log::alert(sprintf('%s:! Ignoring duplicate echomail [%s] in [%s] from (%s) [%s] to (%s).', @@ -171,7 +176,7 @@ class MessageProcess implements ShouldQueue $o->datetime = $this->msg->date; $o->tzoffset = $this->msg->date->utcOffset(); - $o->fftn_id = ($x=$this->msg->fboss_o) ? $x->id : NULL; + $o->fftn_id = ($x=$this->msg->fboss_o) ? $x->id : NULL; // @todo This should be the node that originated the message - but since that node is not in the DB it would be null $o->echoarea_id = $ea?->id; $o->msgid = $this->msg->msgid;