Skip to content

v4.2.0

Choose a tag to compare

@FluffyDiscord FluffyDiscord released this 20 Mar 19:01
· 6 commits to master since this release

Update allows you to reset your services after response has been sent instead of when request arrives. This allows your worker to respond to new requests quicker.

The default behavior of Symfony's kernel is to reset your services before request is handled and slows down the initial reaction time.

When new request arrives Your app After response was sent back
Symfony does a reset, if something fails here, request may be lost waits for reset to be done, then handles your request
RoadRunnerBundle immediately handles your request does a reset

You might want to manually refresh Doctrine connections before each request is handled you are using Mysql, MariaDB or other database that cannot handle long/persistent connection. For this, it's up to you to create event listener for WorkerRequestReceivedEvent

PS: PostgreSQL does not need this workaround .

To disable Symfony's resetting when request arrives, adjust your kernel class as shown bellow.

<?php

namespace App\Kernel;

- use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
+ use FluffyDiscord\RoadRunnerBundle\Kernel\RoadRunnerMicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;

class Kernel extends BaseKernel
{
-    use MicroKernelTrait;
+    use RoadRunnerMicroKernelTrait;
}