How to get rid of interval checkings
-
Hi friends. I have a database and people send some info into this db. But sending time is totally random. So now i check this db every 20 seconds and refresh my program according to new data. But as my user count increases, i need a more efficient approach. I mean how can my program know that somebody added something new into db.
-
Hi friends. I have a database and people send some info into this db. But sending time is totally random. So now i check this db every 20 seconds and refresh my program according to new data. But as my user count increases, i need a more efficient approach. I mean how can my program know that somebody added something new into db.
Informing each client of each change in the database is a known anti-pattern; not only does it generate quite some traffic, it also moves the problem of concurrent edits to the UI.
leone wrote:
i need a more efficient approach
Add a table that holds the "last" datetime that you "modified" your tables. Would consist of two columns; datetime and the name of the table that's changed. Have the client query that table to see if there are any changes. Means fetching data from a table, and the last modification-datetime for that table :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]