File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Jobs Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,35 @@ public function __construct(
5151 $ this ->message = $ message ;
5252 }
5353
54+ /**
55+ * Fire the job.
56+ * @return void
57+ * @throws Exception
58+ */
59+ public function fire ()
60+ {
61+ $ payload = $ this ->payload ();
62+
63+ list ($ class , $ method ) = $ this ->parseJob ($ payload ['job ' ]);
64+
65+ $ this ->instance = $ this ->resolve ($ class );
66+
67+ try {
68+ $ this ->instance ->{$ method }($ this , $ payload ['data ' ]);
69+ } catch (Exception $ exception ) {
70+ if (
71+ $ this ->causedByDeadlock ($ exception ) ||
72+ Str::contains ($ exception ->getMessage (), ['detected deadlock ' ])
73+ ) {
74+ sleep (2 );
75+ $ this ->fire ();
76+ return ;
77+ }
78+
79+ throw $ exception ;
80+ }
81+ }
82+
5483 /**
5584 * Get the number of times the job has been attempted.
5685 *
You can’t perform that action at this time.
0 commit comments