setTimeout around engine.save #142

Closed
opened 2016-06-08 13:09:02 +00:00 by dannybloe · 6 comments
dannybloe commented 2016-06-08 13:09:02 +00:00 (Migrated from github.com)

We are currently using redux-storage and are experiencing that it slows down our app quite significantly due to many writes (debouncing didn't help in our case). As a small experiment we put a setTimeout(.., 1000) around the engine.save() command because we only want to save stuff as soon as there is no UI thread doing anything. And lo and behold, that surely sped things up quite a bit.

Would it be possible to have this as a feature and if not, are there complications?

Cheers,

Danny

We are currently using redux-storage and are experiencing that it slows down our app quite significantly due to many writes (debouncing didn't help in our case). As a small experiment we put a setTimeout(.., 1000) around the engine.save() command because we only want to save stuff as soon as there is no UI thread doing anything. And lo and behold, that surely sped things up quite a bit. Would it be possible to have this as a feature and if not, are there complications? Cheers, Danny
michaelcontento commented 2016-06-08 13:28:49 +00:00 (Migrated from github.com)

But shouldn't redux-storage-decorator-debounce be the right solution for you?

import debounce from 'redux-storage-decorator-debounce'
engine = debounce(engine, 1000);

Should have the same effect as your experiment, as debounce also uses setTimeout !?

But shouldn't [redux-storage-decorator-debounce](https://github.com/michaelcontento/redux-storage-decorator-debounce) be the right solution for you? ``` js import debounce from 'redux-storage-decorator-debounce' engine = debounce(engine, 1000); ``` Should have the same effect as your experiment, as `debounce` also uses `setTimeout` !?
dannybloe commented 2016-06-08 13:29:29 +00:00 (Migrated from github.com)

/me scratches his head... and tries again

/me scratches his head... and tries again
michaelcontento commented 2016-06-08 13:41:33 +00:00 (Migrated from github.com)

😂

😂
dannybloe commented 2016-06-08 13:44:46 +00:00 (Migrated from github.com)

Doh.. we had a too-low debounce timeout value. Ignore this :)

Doh.. we had a too-low debounce timeout value. Ignore this :)
dannybloe commented 2016-06-14 13:33:38 +00:00 (Migrated from github.com)

Ehm... is it possible to do a write on onBeforeUnload if it happens before the debounce timeout?

Ehm... is it possible to do a write on onBeforeUnload if it happens before the debounce timeout?
michaelcontento commented 2016-06-14 14:34:25 +00:00 (Migrated from github.com)

You mean window.onBeforeUnload? Please file a bug with this at redux-storage-decorator-debounce

You mean `window.onBeforeUnload`? Please file a bug with this at [redux-storage-decorator-debounce](https://github.com/michaelcontento/redux-storage-decorator-debounce)
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MichaelContento/redux-storage#142
No description provided.