I have a webapp that opens a connection to a db for each session (each user)
in one section of the app, the user can launch a very long data processing encapsulated in a webtimer.
when one of the users launches this processing, all the other users are blocked until the end of this processing.
I thought of entrusting this processing to a thread, but I didn’t understand whether the webapp or the connection to the db was generating the problem (connection to the db which, however, should be different from user to user … since I open it in the session )
Hi,
Could you be more specific ?
What Xojo version ?
What DB ? SQLite, MySQL, … ?
I would be interesting to know what kind of DB operations you have in this web timer.
Are you using transactions ? Are you just querying or inserting, updating ?
First of all, use a webThread, not a timer. Timer runs on the main thread, and yes, that will prevent anything else from running while it’s going.
Next, make sure you call me.sleep periodically anywhere you are processing data in that thread. In loops, you can use a modulus operator to have it not run on every loop, but you definitely need to allow other threads to run to avoid lockups.
Xojo web apps are SINGLE THREADED. If you need a lot of processing, you should consider to use helper apps to do it in the background. You can use the database coordinate the apps.