Turns out we don't really have a use case for synchronous notifications: all the code that's triggered via events runs in isolation from the request/response flow and its result does not impact what we send back to the user.
For that reason we want to run all notifications asynchronously.
The simplest way to do it without an external service is to use a multiprocess.Pool where notifications jobs are added, and let workers pick the work to do.
The workers can be attached to the pyramid app as an utility for example.
Here's an implementation example of such a pool : https://github.com/AcrDijon/henet/blob/master/henet/workers.py
Turns out we don't really have a use case for synchronous notifications: all the code that's triggered via events runs in isolation from the request/response flow and its result does not impact what we send back to the user.
For that reason we want to run all notifications asynchronously.
The simplest way to do it without an external service is to use a multiprocess.Pool where notifications jobs are added, and let workers pick the work to do.
The workers can be attached to the pyramid app as an utility for example.
Here's an implementation example of such a pool : https://github.com/AcrDijon/henet/blob/master/henet/workers.py