Posts: 2,261
Threads: 196
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
10-16-2023, 11:22 PM
(This post was last modified: 10-16-2023, 11:23 PM by Alexandre Machado.)
You can, if you spawn a thread and let it handle the slow task.
In your example, you can't basically because the session is locked responding to that request that takes a long time to return. Remember that althought the server can handle mulitiple requests at the same time from different sessions, it needs to finish one request from one session before working on another request from the same session. This is the only way to keep the coherency of the session (i.e. 2 different conflicting actions won't interefere with each other).
So, the option is to run the process within a thread and let the server respond to the request. The issue that you will have with this approach is that later you will need to check the server for the completion of the request.
If you give me more details about your requirements we can expand it a bit more
Posts: 2,261
Threads: 196
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
What exactly do you want to accomplish (if you don't mind sharing) and why your code doesn't work in threads? Consider that whatever your code is doing it should - at least - work well inside the thread that IW creates to execute it...