Additional fixes for 14616471
This commit is contained in:
parent
99dc13b297
commit
c6458219bf
@ -170,20 +170,16 @@ class AddressPoll implements ShouldQueue, ShouldBeUnique
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}),
|
||||
|
||||
// If there is no mail anymore, no need trying
|
||||
Skip::unless(function(): bool {
|
||||
if ($this->force
|
||||
|| ($this->ao->echomailWaitingCount() > 0)
|
||||
|| ($this->ao->fileWaitingCount() > 0)
|
||||
|| ($this->ao->netmailWaitingCount() > 0)) {
|
||||
// If there is no mail anymore, no need trying
|
||||
if ((! $this->force)
|
||||
&& ($this->ao->echomailWaitingCount() === 0)
|
||||
&& ($this->ao->filesWaitingCount() === 0)
|
||||
&& ($this->ao->netmailWaitingCount() === 0)) {
|
||||
Log::info(sprintf('%s:/ Nothing waiting - abandoning poll [%s]',self::LOGKEY,$this->ao->ftn));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Log::info(sprintf('%s:/ Nothing waiting - abandoning poll [%s]',self::LOGKEY,$this->ao->ftn));
|
||||
return FALSE;
|
||||
}),
|
||||
];
|
||||
|
@ -976,14 +976,13 @@ class Address extends Model
|
||||
/**
|
||||
* Echomail waiting to be sent to this address
|
||||
*
|
||||
* @return Collection
|
||||
* @return Builder
|
||||
*/
|
||||
public function echomailWaiting(): Collection
|
||||
public function echomailWaiting(): Builder
|
||||
{
|
||||
return Echomail::Uncollected()
|
||||
->where('address_id',$this->id)
|
||||
->orderby('id')
|
||||
->get();
|
||||
->orderby('id');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -993,22 +992,20 @@ class Address extends Model
|
||||
*/
|
||||
public function echomailWaitingCount(): int
|
||||
{
|
||||
return Echomail::Uncollected()
|
||||
->where('address_id',$this->id)
|
||||
return $this->echomailWaiting()
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Files waiting to be sent to this address
|
||||
*
|
||||
* @return Collection
|
||||
* @return Builder
|
||||
*/
|
||||
public function filesWaiting(): Collection
|
||||
public function filesWaiting(): Builder
|
||||
{
|
||||
return File::Uncollected()
|
||||
->where('address_id',$this->id)
|
||||
->orderby('id')
|
||||
->get();
|
||||
->orderby('id');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1018,8 +1015,7 @@ class Address extends Model
|
||||
*/
|
||||
public function filesWaitingCount(): int
|
||||
{
|
||||
return File::Uncollected()
|
||||
->where('address_id',$this->id)
|
||||
return $this->filesWaiting()
|
||||
->count();
|
||||
}
|
||||
|
||||
@ -1094,7 +1090,7 @@ class Address extends Model
|
||||
if ($count > $this->system->batch_files)
|
||||
Log::notice(sprintf('%s:= Only sending [%d] files for [%s]',self::LOGKEY,$this->system->batch_files,$this->ftn));
|
||||
|
||||
return $num->take($this->system->batch_files);
|
||||
return $num->take($this->system->batch_files)->get();
|
||||
}
|
||||
|
||||
return new Collection;
|
||||
@ -1169,16 +1165,14 @@ class Address extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Count of echomail waiting to be sent to this address
|
||||
* Count of netmail waiting to be sent to this address
|
||||
*
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function netmailWaitingCount(): int
|
||||
{
|
||||
return Netmail::Uncollected()
|
||||
->whereIn('tftn_id',$this->downlinks()
|
||||
->add($this)
|
||||
->pluck('id'))
|
||||
return $this->netmailWaiting()
|
||||
->count();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user