> My problem is that while 99% of the views make read-only requests to the
> database, and thus are very fast, the analytics event is a writing and can
> be slow occasionally.
>

You can do post commit actions with SQLAlchemy and zope.sqlaclhemy.

1. Response gets served
2. Database transaction get committed for this request
3. Post transaction actions

Example:

https://stackoverflow.com/questions/15593516/how-to-run-a-script-after-pyramids-transaction-manager-has-returned

Please not that thread local `transaction.manager` might be discouraged
nowadays, but not sure what is the best practice to get a transaction
manager for your request.

Br,
Mikko



> Would it be possible to somehow send the request to the client and still
> keep processing the view? Like a send() + end() method or something
> similar, without returning?
>
> // Adding to a tasks queue is not an option as it'd be an overkill and an
> overcomplicated solution, which wouldn't work for hundreds of thousands of
> events per day.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pylons-discuss+unsubscr...@googlegroups.com.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/c44e1af6-8c30-478e-9baf-d7fd8c93e0b5%40googlegroups.com
> <https://groups.google.com/d/msgid/pylons-discuss/c44e1af6-8c30-478e-9baf-d7fd8c93e0b5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAK8RCUtJnMXXTr99DCgP6LkMaCwwkAeLLqUQ5Xk_h_WjSd8XrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to