Revert observer-wide after-commit; keep saved() job hook.

PostCreated already waits for commit via ShouldDispatchAfterCommit.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Paulo Castellano 2026-07-24 12:08:37 -03:00
parent 52f6506b3c
commit 254b7d514b

View file

@ -9,9 +9,8 @@
use App\Events\PostCreated;
use App\Jobs\Automation\DispatchPostTriggerAutomationsJob;
use App\Models\Post;
use Illuminate\Contracts\Events\ShouldHandleEventsAfterCommit;
class PostObserver implements ShouldHandleEventsAfterCommit
class PostObserver
{
public function created(Post $post): void
{
@ -34,6 +33,6 @@ public function saved(Post $post): void
return;
}
DispatchPostTriggerAutomationsJob::dispatch($post, $triggerType);
DispatchPostTriggerAutomationsJob::dispatch($post, $triggerType)->afterCommit();
}
}