ertank 28 Posted May 5, 2023 Hello, There are some chain requests triggered from clients. Some requests among them takes time processing on the server side. I should send a response to client fast. Server side operations are not relevant to the response. Since, MARS is handling each request in a separate thread, I also created a custom thread for this time consuming operation and process it. My problem is, database context is removed as soon as response is sent and its thread is destroyed. Any further database operations from that point in my custom thread results in access violation. Is there a way that I can get a database connection from MARS database pool for my own custom threads independent of requests? Thanks & Regards, Ertan Share this post Link to post
Arnaud Bouchez 407 Posted May 5, 2023 (edited) Don't mess with the threads or DB connections of the HTTP/REST server. You would depend on an implementation detail of Mars, with no guaranty it stays the same in the future. If you have a long process, then a temporary dedicated connection is just fine. You could reuse the thread and its connection, for the next requests: add a queue to your thread, for pending requests. Edited May 5, 2023 by Arnaud Bouchez Share this post Link to post