Change dupe checking as per FTS-0009.001

This commit is contained in:
Deon George 2021-10-18 23:10:15 +11:00
parent b246f0051f
commit 53a96a8dbd

View File

@ -2,6 +2,7 @@
namespace App\Jobs; namespace App\Jobs;
use Carbon\Carbon;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
@ -142,8 +143,12 @@ class MessageProcess implements ShouldQueue
->single(); ->single();
// Check for duplicate messages // Check for duplicate messages
// FTS-0009.001
if ($this->msg->msgid) { 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) { if ($o) {
Log::alert(sprintf('%s:! Ignoring duplicate echomail [%s] in [%s] from (%s) [%s] to (%s).', 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->datetime = $this->msg->date;
$o->tzoffset = $this->msg->date->utcOffset(); $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->echoarea_id = $ea?->id;
$o->msgid = $this->msg->msgid; $o->msgid = $this->msg->msgid;