stellar-client icon indicating copy to clipboard operation
stellar-client copied to clipboard

Add debounced wallet syncer subsystem

Open nullstyle opened this issue 11 years ago • 0 comments

We're now starting to do more and more wallet syncs that happen because of user interaction. Favorite currency pairs, gateways, settings, etc.

Rather than allowing us to get into a position where we are spamming the wallet server with multiple updates per second, we should develop a system that debounces the sync process. This should be expressed in the config file as something like:

LOW_PRIORITY_SYNC_INTERVAL = 5000; //i.e. at most one save per 5 seconds

A consumer should be allowed to override the debounce by passing {force: true} as an option to session.syncWallet():

// the two lines below only result in a single save of the wallet
session.syncWallet('update');
session.syncWallet('update');

// the two lines below hit the server twice
session.syncWallet('update', {force: true});
session.syncWallet('update', {force: true});

nullstyle avatar Sep 25 '14 17:09 nullstyle