I am trying to implement an anonymous chat web application in Django. Right now I am on the stage where I need to connect users with each other based on their preferences, location etc.
So I have a view find_room(request), where I am executing lengthy algorithm which runs for a few seconds, trying to find the closest user who is also searching for other users using the same view.
So my problem is that when one user is calling the find_room view and then the other user calling the same view, then the second user should wait until first users's call is ended.
So basically I need this view to be executed as a separate thread, so that several users can call this view and use this searching algorithm in the same time. Is there any functionality inside django that can help me? Or are there any other technologies I should use? (I heard about celery, but not sure if this is right thing for my purposes).
Sorry if the question is confusing, and thanks for the answers!