Hello guys, I have got little problem during developing notification functionality in Pylons-based application. We use multi-server configuration with 4 Paste servers (with 10-threads threadpool for each server). I decided to implement is as background thread which through scheduler runs check for notifications every minute.
in Python script I imported: *import thread, threading* and in main make_app function added following: *thread.start_new_thread(timingforalerts, (app_globals, config, ))* > *#creates separate thread for searching pending alerts* *timingforalerts()* is my function which queries database for pending alerts and if any are found sends notifications through e-mail/jabber. *PROBLEM* is that this thread is started on EACH server, so that means there are FOUR threads created for searching alerts. It affects that when notification is found user receives four email or four Jabber messages. Please help me figure out how to start thread only on one server (for example only on server:main). Configuration in development.ini looks following: *[server:main]* use = egg:Paste#http host = 127.0.0.1 port = 5000 use_threadpool = True threadpool_workers = 10 *[server:main2]* use = egg:Paste#http host = 127.0.0.1 port = 5001 use_threadpool = True threadpool_workers = 10 *[server:main3]* use = egg:Paste#http host = 127.0.0.1 port = 5002 use_threadpool = True threadpool_workers = 10 *[server:main4]* use = egg:Paste#http host = 127.0.0.1 port = 5003 use_threadpool = True threadpool_workers = 10 -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/groups/opt_out.
