Thank you, add_rb_timer can work, but I get an error:
[uwsgi-signal] you have registered this signal in worker 1 memory area, only
that process will be able to run it Sun Apr 29 11:33:12 2012 - error managing
signal 99 on worker 2
Code:
functions.py
def send_html_mail(subject, html_content, recipient_list):
msg = EmailMessage(subject, html_content, settings.EMAIL_HOST_USER,
recipient_list)
msg.content_subtype = "html" # Main content is now text/html
msg.send()
def timer_test(num):
send_html_mail("test_timer", "<b>Work</b>", ["[email protected]"])
views.py
def index(request):
#task.myspooler.spool(filename="/var/www/conf")
uwsgi.register_signal(99, "", functions.timer_test)
uwsgi.add_rb_timer(99, 10, 1)
#functions.timer_test(10)
return render_to_response("index.html", locals())
------------------ Original ------------------
From: "Roberto De Ioris"<[email protected]>;
Date: Sun, Apr 29, 2012 10:32 AM
To: "uWSGI developers and users list"<[email protected]>;
Subject: Re: [uWSGI] add_timer one-shot
> Hi,
>
> I want to use one shot timer , but when I use uwsgi.add_timer(30, 40, 1),
> I get a exception:
>
>
> TypeError at /
> add_timer() takes exactly 2 arguments (3 given)
>
> Is this a bug or am I missing something?
>
> uwsgi virson == 1.1.2_______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
Oneshot timers are only available in redblack mode:
uwsgi.add_rb_timer(signum, secs, iterations)
set iterations = 1 to have a one-shot timer
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi