Skip to content

Commit

Permalink
Update RemoteStatusDelete and DecrementPostCount pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Oct 11, 2023
1 parent 4e35f0d commit edbcf3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 3 additions & 9 deletions app/Jobs/ProfilePipeline/DecrementPostCount.php
Expand Up @@ -43,15 +43,9 @@ public function handle()
return 1;
}

if($profile->updated_at && $profile->updated_at->lt(now()->subDays(30))) {
$profile->status_count = Status::whereProfileId($id)->whereNull(['in_reply_to_id', 'reblog_of_id'])->count();
$profile->save();
AccountService::del($id);
} else {
$profile->status_count = $profile->status_count ? $profile->status_count - 1 : 0;
$profile->save();
AccountService::del($id);
}
$profile->status_count = $profile->status_count ? $profile->status_count - 1 : 0;
$profile->save();
AccountService::del($id);

return 1;
}
Expand Down
11 changes: 4 additions & 7 deletions app/Jobs/StatusPipeline/RemoteStatusDelete.php
Expand Up @@ -37,6 +37,7 @@
use App\Services\CollectionService;
use App\Services\StatusService;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use App\Jobs\ProfilePipeline\DecrementPostCount;

class RemoteStatusDelete implements ShouldQueue
{
Expand All @@ -51,7 +52,7 @@ class RemoteStatusDelete implements ShouldQueue
*/
public $deleteWhenMissingModels = true;

public $timeout = 90;
public $timeout = 180;
public $tries = 2;
public $maxExceptions = 1;

Expand All @@ -62,7 +63,7 @@ class RemoteStatusDelete implements ShouldQueue
*/
public function __construct(Status $status)
{
$this->status = $status;
$this->status = $status->withoutRelations();
}

/**
Expand All @@ -77,14 +78,10 @@ public function handle()
if($status->deleted_at) {
return;
}
$profile = $this->status->profile;

StatusService::del($status->id, true);

if($profile->status_count && $profile->status_count > 0) {
$profile->status_count = $profile->status_count - 1;
$profile->save();
}
DecrementPostCount::dispatch($status->profile_id)->onQueue('inbox');

return $this->unlinkRemoveMedia($status);
}
Expand Down

0 comments on commit edbcf3e

Please sign in to comment.