开发者

how to make a thread of never stop, and write something to database every 10 second

开发者 https://www.devze.com 2022-12-28 02:08 出处:网络
i using gae and django this is my code: class LogText(db.Model): content = db.StringProperty(multiline=True)

i using gae and django

this is my code:

class LogText(db.Model):
    content = db.StringProperty(multiline=True)


class MyThread(threading.Thread):
    def __init__(self,threadname):
        threading.Thread.__init__(self, name=threadname)
    def run(self,request):
        log=LogText()
        log.content=request.POST.get('content',None)
        log.put()

de开发者_运维知识库f Log(request):
    thr = MyThread('haha')
    thr.run(request)

    return HttpResponse('')


It's impossible to do in GAE since all requests (including cron job) have 30 seconds deadline.

0

精彩评论

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

关注公众号