Fixes to message processing, now that we are using cockroachdb

This commit is contained in:
Deon George
2022-01-15 13:06:15 +11:00
parent e78e79a8f5
commit 6f1d47a6ab
8 changed files with 119 additions and 82 deletions

View File

@@ -166,16 +166,13 @@ class MessageProcess implements ShouldQueue
if (! $o->msg_crc)
$o->msg_crc = md5($this->msg->message);
// Using filter here, due to earlier bugs - and to get rid of the null values
$o->path = collect($o->getRawOriginal('path'))->filter()->toArray();
$o->save();
// If the path is empty, then its probably because of the previous bug, we'll replace it.
// @todo This duplicate message may have gone via a different path, be nice to record it.
if (! $o->path->count())
$o->path = collect($o->getRawOriginal('path'))->merge($this->msg->pathaddress)->toArray();
$o->seenby = collect($o->getRawOriginal('seenby'))->merge($this->msg->seenaddress)->filter()->toArray();
$o->save();
//$o->path()->sync($o->path->pluck('id')->merge($this->msg->pathaddress)->toArray());
// @todo if we have an export for any of the seenby addresses, remove it
$o->seenby()->sync($o->seenby->pluck('id')->merge($this->msg->seenaddress)->filter()->toArray());
return;
}
@@ -215,11 +212,10 @@ class MessageProcess implements ShouldQueue
$o->msg = $this->msg->message_src;
$o->msg_crc = md5($this->msg->message);
$o->path = $this->msg->pathaddress->jsonSerialize();
$o->rogue_path = $this->msg->rogue_path->jsonSerialize();
$o->seenby = $this->msg->seenaddress->jsonSerialize();
$o->rogue_seen = $this->msg->rogue_seen->jsonSerialize();
$o->toexport = TRUE;
$o->rogue_seenby = $this->msg->rogue_seenby;
$o->rogue_path = $this->msg->rogue_path;
$o->set_path = $this->msg->pathaddress->toArray();
$o->set_seenby = $this->msg->seenaddress->toArray();
$o->save();