Compare commits

...

2 Commits

Author SHA1 Message Date
47af5384f6 Fixes for Zmodem missed in bf3fce
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m34s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
2024-11-28 00:44:29 +11:00
4ba0551107 Remove/reduce usage of QueryCache 2024-11-28 00:44:29 +11:00
9 changed files with 33 additions and 23 deletions

View File

@ -58,7 +58,7 @@ final class Mail extends Send
if ($successful) { if ($successful) {
$this->complete = TRUE; $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 // Update netmail table
if (($this->type === Send::T_NETMAIL) if (($this->type === Send::T_NETMAIL)

View File

@ -288,6 +288,8 @@ abstract class Protocol
else { else {
Log::withContext(['pid'=>getmypid()]); Log::withContext(['pid'=>getmypid()]);
Log::debug(sprintf('%s:* Client session starting',self::LOGKEY));
$this->session($client,(new Address)); $this->session($client,(new Address));
} }

View File

@ -921,8 +921,16 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
$t1 = $this->client->timer_set(self::EMSI_HSTIMEOUT); $t1 = $this->client->timer_set(self::EMSI_HSTIMEOUT);
$t2 = $this->client->timer_set(self::EMSI_RESEND_TO); $t2 = $this->client->timer_set(self::EMSI_RESEND_TO);
$c = 0;
while (! $this->client->timer_expired($t1)) { while (! $this->client->timer_expired($t1)) {
$ch = $this->client->read_ch(max( 1,min($this->client->timer_rest($t1),$this->client->timer_rest($t2)))); try {
$ch = $this->client->read_ch(max( 1,min($this->client->timer_rest($t1),$this->client->timer_rest($t2))));
} catch (SocketException $e) {
if ($c++ > 2)
return self::TIMEOUT;
}
if (static::DEBUG) if (static::DEBUG)
Log::debug(sprintf('%s:- Got [%x] (%c)',self::LOGKEY,$ch,$ch)); Log::debug(sprintf('%s:- Got [%x] (%c)',self::LOGKEY,$ch,$ch));
@ -1193,7 +1201,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
Log::debug(sprintf('%s:+ Start WAZOO Receive',self::LOGKEY)); Log::debug(sprintf('%s:+ Start WAZOO Receive',self::LOGKEY));
// @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes. // @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes.
$rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address,$this->force_queue); $rc = (new Zmodem($this->setup))->zmodem_receive($this->client,$zap,$this->recv,$this->node->address,$this->force_queue);
return ($rc === self::RCDO || $rc === self::ERROR); return ($rc === self::RCDO || $rc === self::ERROR);
} }
@ -1217,7 +1225,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
foreach ($this->node->aka_remote_authed as $ao) { foreach ($this->node->aka_remote_authed as $ao) {
// Send mail // Send mail
while ($this->send->mail($ao)) { while ($this->send->mail($ao)) {
$z = new Zmodem; $z = new Zmodem($this->setup);
if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->togo_count) if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->togo_count)
$z->zmodem_sendfile($this->send,$this->node); $z->zmodem_sendfile($this->send,$this->node);
@ -1225,7 +1233,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// Send files // Send files
while ($this->send->files($ao)) { while ($this->send->files($ao)) {
$z = new Zmodem; $z = new Zmodem($this->setup);
if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->togo_count) if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->togo_count)
$z->zmodem_sendfile($this->send,$this->node); $z->zmodem_sendfile($this->send,$this->node);

View File

@ -127,6 +127,8 @@ final class SocketServer {
if (($accept = socket_accept($this->server)) === FALSE) if (($accept = socket_accept($this->server)) === FALSE)
throw new SocketException(SocketException::CANT_ACCEPT,socket_strerror(socket_last_error($this->server))); throw new SocketException(SocketException::CANT_ACCEPT,socket_strerror(socket_last_error($this->server)));
Log::debug(sprintf('%s:* TCP Loop Start',self::LOGKEY));
try { try {
$r = new SocketClient($accept); $r = new SocketClient($accept);

View File

@ -50,7 +50,6 @@ class MailSend #implements ShouldQueue
->join('domains',['domains.id'=>'zones.domain_id']) ->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') ->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']) ->with(['system','zone.domain'])
->dontCache()
->get(); ->get();
// Return the system we poll // Return the system we poll

View File

@ -233,13 +233,6 @@ class MessageProcess implements ShouldQueue
// Check for duplicate messages // Check for duplicate messages
// FTS-0009.001 // FTS-0009.001
if ($this->mo->msgid) { 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].', Log::debug(sprintf('%s:- Checking for duplicate from host id [%d], with msgid [%s] between [%s] and [%s].',
self::LOGKEY, self::LOGKEY,
$this->mo->fftn_id, $this->mo->fftn_id,
@ -248,6 +241,11 @@ class MessageProcess implements ShouldQueue
$this->mo->datetime, $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()) { if ($x->count()) {
// @todo Actually update seenby // @todo Actually update seenby
Log::alert(sprintf('%s:! Duplicate echomail (%s) in [%s] from (%s) [%s] to (%s) - ignoring.', 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)) $o = Echomail::where('msg_crc',$xx=md5($this->mo->msg_crc))
->where('fftn_id',$this->mo->fftn_id) ->where('fftn_id',$this->mo->fftn_id)
->where('datetime','>',Carbon::now()->subWeek()) ->where('datetime','>',Carbon::now()->subWeek())
->dontCache()
->get(); ->get();
if ($o->count()) if ($o->count())

View File

@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Packet}; use App\Classes\FTN\{Message,Packet};
use App\Exceptions\InvalidFTNException; use App\Exceptions\InvalidFTNException;
use App\Traits\ScopeActive; use App\Traits\{QueryCacheableConfig,ScopeActive};
/** /**
* This represents an FTN AKA. * This represents an FTN AKA.
@ -48,7 +48,7 @@ use App\Traits\ScopeActive;
class Address extends Model class Address extends Model
{ {
use ScopeActive,SoftDeletes; use ScopeActive,SoftDeletes,QueryCacheableConfig;
private const LOGKEY = 'MA-'; private const LOGKEY = 'MA-';
@ -469,7 +469,8 @@ class Address extends Model
->whereNotNull('export_at') ->whereNotNull('export_at')
->whereNull('sent_at') ->whereNull('sent_at')
->whereNull('echomails.deleted_at') ->whereNull('echomails.deleted_at')
->groupBy('addresses.id'); ->groupBy('addresses.id')
->dontCache();
} }
public function scopeUncollectedEchomailTotal($query) public function scopeUncollectedEchomailTotal($query)
@ -503,7 +504,8 @@ class Address extends Model
->whereNotNull('export_at') ->whereNotNull('export_at')
->whereNull('sent_at') ->whereNull('sent_at')
->whereNull('files.deleted_at') ->whereNull('files.deleted_at')
->groupBy('addresses.id'); ->groupBy('addresses.id')
->dontCache();
} }
public function scopeUncollectedFilesTotal($query) public function scopeUncollectedFilesTotal($query)
@ -535,7 +537,8 @@ class Address extends Model
->whereNull('sent_pkt') ->whereNull('sent_pkt')
->whereNull('sent_at') ->whereNull('sent_at')
->whereNull('netmails.deleted_at') ->whereNull('netmails.deleted_at')
->groupBy('addresses.id'); ->groupBy('addresses.id')
->dontCache();
} }
/** /**

View File

@ -13,11 +13,11 @@ use App\Classes\FTN\Message;
use App\Events\Echomail as EchomailEvent; use App\Events\Echomail as EchomailEvent;
use App\Interfaces\Packet; use App\Interfaces\Packet;
use App\Models\Casts\{CompressedStringOrNull,CollectionOrNull,UTF8StringOrNull}; 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 final class Echomail extends Model implements Packet
{ {
use SoftDeletes,MessageAttributes,MsgID,ParseAddresses,QueryCacheableConfig; use SoftDeletes,MessageAttributes,MsgID,ParseAddresses;
private const LOGKEY = 'ME-'; private const LOGKEY = 'ME-';
public const UPDATED_AT = NULL; public const UPDATED_AT = NULL;
@ -291,7 +291,6 @@ final class Echomail extends Model implements Packet
return $this->belongsToMany(Address::class,'echomail_seenby') return $this->belongsToMany(Address::class,'echomail_seenby')
->select(['addresses.id','zone_id','host_id','node_id']) ->select(['addresses.id','zone_id','host_id','node_id'])
->withPivot(['export_at','sent_at','sent_pkt']) ->withPivot(['export_at','sent_at','sent_pkt'])
->dontCache()
->FTN2DOrder(); ->FTN2DOrder();
} }

View File

@ -11,7 +11,7 @@ trait QueryCacheableConfig
{ {
use QueryCacheable; use QueryCacheable;
public $cacheFor = 900; // cache time, in seconds public $cacheFor = 30; // cache time, in seconds
protected static $flushCacheOnUpdate = TRUE; protected static $flushCacheOnUpdate = TRUE;
public $cacheDriver = 'memcached'; public $cacheDriver = 'memcached';
} }