so I have a handler below:
class PublishHandler(BaseHandler): def post(self): message = self.get_argument("message") some_function(message) self.write("success")
The problem that I am facing is that some_function () takes some time to execute, and I would like the post request to be returned immediately when called and for some_function () to be executed in another thread / process, if possible.
I use berkeley db as a database, and what I'm trying to do is relatively simple.
I have a user database with a filter. If the filter matches the message, the server will send a message to the user. I am currently testing thousands of users, and therefore, every time I post a message through an email request, it iterates through thousands of users to find a match. This is my naive implementation of affairs and, therefore, my question. How can I do it better?
python tornado
John jiang
source share