• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Syncronize AJAX requests: Client or Server Sync?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have the following scenario:

I have a data grid which gets data for its rows from json (ajax). I have filters for some of the grid's columns. Also, I have an autupdate operation (polling), which is an AJAX request that retrieves only the updated rows, based on the filters and a session variable that keeps the latest update time and checks if the latest update time in the db is greater than the stored value. If it is the grid is updated (rows are added or updated).

My issue:

The filter operation collides with the polling operation. When a filter is entered by the user, depending on the timing, the polling operation gets called with this filter as a parameter (so it gets the udpated records filtered by the new filter) and returns before the filter operation has returned. In this case the grid is not update correctly as you can assume.

Is there any best practice on how to deal with this situation? When the polling is very frequent (every 1 sec) this issue arises every time.

I have never stumbled upon this issue and I am wondering if I should sync the two processes. And if so, should I sync in the server, or the client? And how?

Thank you very much in advance.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disable the polling while an update is in progress.
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic