mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 17:26:43 +00:00
Update RemoteStatusDelete and DecrementPostCount pipelines
This commit is contained in:
parent
4e35f0d32e
commit
edbcf3ed79
2 changed files with 7 additions and 16 deletions
|
@ -43,15 +43,9 @@ class DecrementPostCount implements ShouldQueue
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($profile->updated_at && $profile->updated_at->lt(now()->subDays(30))) {
|
$profile->status_count = $profile->status_count ? $profile->status_count - 1 : 0;
|
||||||
$profile->status_count = Status::whereProfileId($id)->whereNull(['in_reply_to_id', 'reblog_of_id'])->count();
|
$profile->save();
|
||||||
$profile->save();
|
AccountService::del($id);
|
||||||
AccountService::del($id);
|
|
||||||
} else {
|
|
||||||
$profile->status_count = $profile->status_count ? $profile->status_count - 1 : 0;
|
|
||||||
$profile->save();
|
|
||||||
AccountService::del($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ use App\Services\AccountService;
|
||||||
use App\Services\CollectionService;
|
use App\Services\CollectionService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
||||||
|
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
||||||
|
|
||||||
class RemoteStatusDelete implements ShouldQueue
|
class RemoteStatusDelete implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,7 @@ class RemoteStatusDelete implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public $deleteWhenMissingModels = true;
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
public $timeout = 90;
|
public $timeout = 180;
|
||||||
public $tries = 2;
|
public $tries = 2;
|
||||||
public $maxExceptions = 1;
|
public $maxExceptions = 1;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ class RemoteStatusDelete implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function __construct(Status $status)
|
public function __construct(Status $status)
|
||||||
{
|
{
|
||||||
$this->status = $status;
|
$this->status = $status->withoutRelations();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +78,10 @@ class RemoteStatusDelete implements ShouldQueue
|
||||||
if($status->deleted_at) {
|
if($status->deleted_at) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$profile = $this->status->profile;
|
|
||||||
|
|
||||||
StatusService::del($status->id, true);
|
StatusService::del($status->id, true);
|
||||||
|
|
||||||
if($profile->status_count && $profile->status_count > 0) {
|
DecrementPostCount::dispatch($status->profile_id)->onQueue('inbox');
|
||||||
$profile->status_count = $profile->status_count - 1;
|
|
||||||
$profile->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->unlinkRemoveMedia($status);
|
return $this->unlinkRemoveMedia($status);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue