Hi Riccardo,

In /etc/init.d/uwsgi I've got:

DAEMON_OPTS="-s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log
--pythonpath $PYTHONPATH --module $MODULE --harakiri-verbose --spooler
$MYSPOOL"
where MYSPOOL=/home/franciscocosta/spooler

I've also got uwsgidecorators.py (
http://projects.unbit.it/uwsgi/browser/uwsgidecorators.py) in my
application modules folder.

In my default controller I have this function test():

from uwsgidecorators import *
@spool
def test():
    for a in range(2000):
        db.person.insert(name = 'name' + str(a))
    return a

but when I open http://localhost/test I get this error: TypeError: 'spool'
object is not callable


Francisco Costa
http://franciscocosta.com



On Thu, Dec 1, 2011 at 11:14, Riccardo Magliocchetti <
[email protected]> wrote:

> Hi,
>
> Il 01/12/2011 11:41, Francisco Costa ha scritto:
>
>> Hi,
>>
>> I'm using web2py + nginx + uwsgi
>>
>> I have a function where I get the users database and then I email them one
>> by one.
>>
>> But when I run this function the page hangs for a few seconds and just
>> loads after all those emails been sent.
>>
>> I was wondering if this problem is possible to solve with the @spool
>> decorator<http://projects.**unbit.it/uwsgi/wiki/Decorators<http://projects.unbit.it/uwsgi/wiki/Decorators>
>> **>, and how do you
>> implement it.
>>
>
> You need to change your config file to add a 'spooler' directive with the
> directory where you want to let the spooler save its jobs, then an 'import'
> directive with the python module where the function with the @spool
> decorator is available. You then need to update your view to call
> your_function.spool().
> Also please remember that you need to have the decorators.py module
> available so you can copy it inside your application.
>
> hope this helps,
> riccardo
> ______________________________**_________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/**mailman/listinfo/uwsgi<http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi>
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to