On Fri, Sep 7, 2012 at 7:15 PM, Roberto De Ioris <[email protected]> wrote: > > Il giorno 07/set/2012, alle ore 18:01, Ævar Arnfjörð Bjarmason > <[email protected]> ha scritto: > >> On Fri, Sep 7, 2012 at 4:45 PM, Roberto De Ioris <[email protected]> wrote: >>> >>> Il giorno 07/set/2012, alle ore 16:26, Ævar Arnfjörð Bjarmason >>> <[email protected]> ha scritto: >>> >>>> Is uWSGI capable of providing support for something like the proposed >>>> psgi cleanup handlers: >>>> https://github.com/plack/psgi-specs/wiki/Proposal:-PSGI-environment-cleanup-handlers >>>> >>>> I.e. having your application send all the relevant content to the >>>> client, but then run other code that the client doesn't have to wait >>>> on? E.g. code that sends statistics to a logging server, sets various >>>> keys in memcached, possibly inserts some things into a database lazily >>>> etc. >>>> _______________________________________________ >>>> uWSGI mailing list >>>> [email protected] >>>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >>> >>> >>> This is how psgix.harakiri.commit is implemented: >>> >>> http://projects.unbit.it/uwsgi/browser/plugins/psgi/psgi_plugin.c#L482 >>> >>> Adding other 'things to do' is a mater of adding a perl_call line in that >>> function. >>> >>> Sadly i have seen no more news regarding official PSGI cleanup handlers, so >>> i think >>> the only solution is doing as we already did with the python plugin, and >>> use uwsgi::after_req_hook >>> mapping to a code ref >> >> Thanks Roberto, do you have any immediate plans to implement this? If >> not I'll just go for it, either by adding a uwsgi::* function as you >> described or just by implementing that psgi proposal. > > > While checking for an rpc-related bug i have found a way to optimize > psgix.harakiri.commit, and then i decided > to implement psgix.cleanup system. > > The relevant patch is here: > > https://github.com/unbit/uwsgi/commit/cf480e499c6080a1f155077e9fbca9fc602473be > > an example usage is here: > > https://github.com/unbit/uwsgi/blob/master/test.psgi
Thanks a lot for this. FWIW I've been running it for a couple of days on some production traffic without any issues. _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
