hirethunk/verbs

[Bug]: Weird behaviour in Queues with Horizon

nick-potts opened this issue · 1 comments

What happened?

Say you have a event like this:

    public function __construct(
        #[StateId(TestState::class)]
        public int|null $state_id
    )
    {
    }
    public function handle()
    {
        throw new \RuntimeException('hi');
    }

and you fire it in a job like so:

    public function handle(): void
    {
        FailsEvent::fire();
    }

    public function failed(\Throwable $e)
    {
        report($e);
    }

Because the autocommiter runs after the handle, the failed job shows up as successful, despite throwing an exception.

In my case, I do actually have Verbs::commit() in my handle method, but due to the way my events fire, for some reason its possible for the autocommiter to still fire and it leads to a very untraceable error.

How to reproduce the bug

as above

Package Version

0.4.3

PHP Version

8.3

Laravel Version

11

Which operating systems does with happen with?

macOS

Notes

No response

I'm going to close this until I figure out some more specifics.