Web app not responding to other users/clients

Hi all, I have the following problem

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 ?

It’s unwise to tie up a UI with a long process. The following would work if XOJO supports web sockets which I’m sure it does.

We handle this by creating a script request record, trigger a background process and return a uuid to the requesting client.

When the background process finishes it broadcasts a message using the uuid down the web socket connections we have in the app.

The clients then refreshes and does what it wants with the data.

Xojo rel 2019r3.2
DB =MS Sql Server 2019 STD

In webtimer are called 20 sub Procedures that

  • select records
  • make a lot of calculations
  • update record and add records
    NO TRANSACTIONS

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.

ok, i try

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.

3 Likes