shlinkio / shlink-event-dispatcher

Event dispatching using PSR-14, with async event listener that are executed in background jobs system
MIT License
4 stars 1 forks source link

Allow hooks/middlewares to be registered for the TaskRunner #23

Closed acelaya closed 4 years ago

acelaya commented 4 years ago

It has to be possible to run arbitrary code before/after a swoole task is executed.

Currently, the use case is to be able to gracefully recover from a closed DB connection, the same way it's done for web workers using the CloseDbConnectionMiddleware, which closes the connection after the execution and reopens it on next request.

acelaya commented 4 years ago

There's a better way to solve this. By decorating listeners so that the actual code is wrapped.