Nodejs on-page data does not update with laggy external DB, including sockets

Potential bug, but I’m leaving this off the “bugs” category as I might be missing something.

Wappler Version : 5.2.3
Operating System : Windows 10
Server Model: Nodejs
Database Type: External Postgres
Hosting Type: Docker

Expected behavior

Server API waits for external DB query to complete before issuing response, or firing next step (including a socket refresh)

Actual behavior

Server API sends response or executes next action well before external query completes

I’ve setup a simple POST API using an external DB with a (rather laggy) connection time. The roundtrip time is about 2s. The API simply performs an insert.

A fresh form page that simply executes the API and refreshes a pull of the table contents.

Action: when the form is submitted, the API post returns a response instantly, then attempts a reload of the SC, well-before the DB insert actually completes.

The crude fix on the forums is to put an endlessly-repeating Action Schedule on-page to refresh the SC, which is too resource-intensive for heavy queries and not ideal for messaging scenarios. Hence sockets. However the issue still persists…

Re-wired the API to use a socket:

Then set the SC on-page to live-refresh via socket and removed the re-load SC from the form-submit on-success action flow.

However, when submitting the form, the SC still DOES NOT load the fresh record. The below vid demonstrated the behavior, and only displays the newly-inserted record when the page is fully-refreshed.

What’s occurring is the API is calling the Refresh Server Action before the laggy DB query completes, rendering the implementation unusable. If I manually add a Wait in the API, which is still undesirable due to not knowing the variable lag-time, the issue surprisingly still persists.

Am I missing something? Or does the API truly not wait for laggy DB connections to close and commit?

Community Page
Last updated: