开发者

cron job and Long process problem

开发者 https://www.devze.com 2022-12-20 04:33 出处:网络
Via django iam launching a thread (via middle ware the moment the first request comes) which continously fetches the twitter public steam and puts it down into the database.Assume the thread name is t

Via django iam launching a thread (via middle ware the moment the first request comes) which continously fetches the twitter public steam and puts it down into the database.Assume the thread name is twitterthread.

I also have have several cron jobs which periodically interacts with other third party api services.

Observed the following Problem:

if i don't launch twitterthread cron j开发者_Python百科obs are running fine. Where as if i launch twitterthread cron jobs are not running

Any idea on what can go wrong? and any guidelines on the way to fix it.


I'd advice to avoid launching threads inside the django application. Most of the times you can run the thread as a separate application.

If you deploy the app in a Apache server and you don't control it properly each Apache process will assume that a request is the first one and you could end up with more than one instance of twitterthread.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号