I have a website that uses jQuery and Python.
I have an Ajax request that executes a python function. Inside the Python function, there is an interface with Linux that runs the C ++ library.
The problem I am facing is when I create two requests to execute this C ++ library from AJAX through Python. The C ++ task may take up to 2 minutes. This is good, however, when I move from the current page, since the previous task is not technically complete, Django will not load me a new page.
Is there any way to determine if the page is moving, and if so, then call python to stop its function so that I can respond.
One of the ways I thought about is streaming, however, when I follow this approach, if I move when the stream is still running, I can see from the debugger that it is returning data, even if I'm not on the page that caused the request .
Does anyone have any ideas how I can get python to kill all threads when navigating from the current page.
Greetings
source
share