File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1208,6 +1208,19 @@ NR_PHP_WRAPPER(nr_laravel_horizon_end_txn) {
12081208}
12091209NR_PHP_WRAPPER_END
12101210
1211+ /*
1212+ * End transaction for idle laravel queue workers and then start
1213+ * a new transaction.
1214+ */
1215+ NR_PHP_WRAPPER (nr_laravel_queue_restart_transaction ) {
1216+ NR_UNUSED_SPECIALFN ;
1217+ (void )wraprec ;
1218+
1219+ nr_php_txn_end (1 , 0 TSRMLS_CC );
1220+ nr_php_txn_begin (NULL , NULL TSRMLS_CC );
1221+ }
1222+ NR_PHP_WRAPPER_END
1223+
12111224void nr_laravel_enable (TSRMLS_D ) {
12121225 /*
12131226 * We set the path to 'unknown' to prevent having to name routing errors.
@@ -1259,6 +1272,15 @@ void nr_laravel_enable(TSRMLS_D) {
12591272 nr_php_wrap_user_function_before_after_clean (
12601273 NR_PSTR ("Laravel\\Horizon\\Console\\SupervisorCommand::handle" ),
12611274 nr_laravel_horizon_end_txn , NULL , NULL );
1275+
1276+ /*
1277+ * The following function has been added to ensure idle laravel queue workers
1278+ * are properly handled by ending the current transaction and starting a new
1279+ * one.
1280+ */
1281+ nr_php_wrap_user_function_before_after_clean (
1282+ NR_PSTR ("Illuminate\\Queue\\Worker::daemonShouldRun" ),
1283+ nr_laravel_queue_restart_transaction , NULL , NULL );
12621284#else
12631285 nr_php_wrap_user_function (NR_PSTR ("Symfony\\Component\\Console\\Application::doRun" ),
12641286 nr_laravel_console_application_dorun TSRMLS_CC );
You can’t perform that action at this time.
0 commit comments