> Hi Roberto > > Your example works. Could it be that i use uWSGI 1.9 and not uWSGI 2.0?
they are basically the same and there are no relevant bugfixes between 1.9.17 and 2.0 can you add a print in your __del__ method to check if it is called too early ? > > > > On Mon, Jan 27, 2014 at 9:50 AM, Roberto De Ioris <[email protected]> > wrote: > >> >> > maybe it would help. I use bottlepy as webframwork >> >> >> this is a sample app based on your code: >> >> # bottiglia.py >> from bottle import route, run, template, default_app >> from threading import Thread >> import time >> >> class Mailer(object): >> >> def __init__(self): >> self._threads = [] >> >> def _send(self): >> while True: >> time.sleep(1) >> print "hello" >> >> def send(self): >> thread = Thread(target=self._send) >> thread.daemon = True >> thread.start() >> self._threads.append(thread) >> >> def join(self): >> return [t.join(5) for t in self._threads] >> >> def __del__(self): >> self.join() >> >> @route('/hello/<name>') >> def index(name): >> m = Mailer() >> m.send() >> return template('<b>Hello {{name}}</b>!', name=name) >> >> application = default_app() >> >> >> i run it with >> >> uwsgi --http-socket :9090 -w bottiglia --enable-threads >> >> and after the request the thread is still alive. >> >> Can you check if it works for you ? (i am using uWSGI 2.0) >> >> -- >> 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 > -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
