Home  >  Q&A  >  body text

python - tornado一个请求就添加一个进程该怎么做?

大致如下

class ListPetHandler(RequestHandler):
    def get(self):
        pass
        
        
class AddPetHandler(RequestHandler):
    def get(self):
        do_something()

其中的do_something()应该是在后端跑起一个独立于tornado server存在的Pet实例,而不是在请求结束之后就消失

PHP中文网PHP中文网2741 days ago323

reply all(3)I'll reply

  • PHPz

    PHPz2017-04-18 09:46:57

    I don’t quite understand what you’re thinking. Why do you want to keep running this instance? Can’t we use redis or the like for content storage?

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:46:57

    Use http://www.celeryproject.org/

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:46:57

    Isn’t the most common threading method enough to open a thread?

    reply
    0
  • Cancelreply