I have a website that uses Jquery and Python.
I have an Ajax Request that performs a python function. Inside the Python Function there is an interface with Linux that executes a C++ Library.
The problem I am having is when I create two requests to execute this C++ Library from AJAX via Python. The C++ Task could take upto 2 minutes to load. This is fine however when I navigate away from the current page since the previous task has technically not completed Django will not load me a new page.
Is there any way I can determaine if the page is navigating away and if so then invoke python to stop its function so I can have some responsiveness.
One way I have thought of is threading however when I perform this approach if i Navigate away while a thread is still executing I can see from the debugger that it returns data even if I am not on the page that called the request.
So does anyone have any ideas how I can get python to kill all threads upon navigation away from its current page.
Cheers