-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for chunked pulls #1866
base: master
Are you sure you want to change the base?
Conversation
@tlonny Hi, some thoughts:
|
Hi @radex Thanks for your reply! We were foolish enough to try to build a multi-inbox, cross platform, offline-first IMAP-based e-mail client. Our intention is to hold e-mail metadata relevant for searching + summary presentation (not message text/attachments) client-side. Even when stored in a relatively concise/compacted format (SQLite) the storage footprint for a single, large inbox can run to >250MB. Presumably, held as an array of JS objects as per the return value of Unfortunately, I don't think turbo would help, as a user is able to add a new email inbox at any point in time and thus we are at risk of memory blow-out at any time - not just during the initial sync. Appreciate your comment about inconsistency - For our use-case, I don't think we would be significantly affected by this - but can certainly understand how other apps could be... If I tidied up this PR, gating this behavior behind a default-false flag (as per my draft), would it be something you'd consider merging? Many Thanks, Tim |
Yes, if it's not the default, then I'm happy with having that in the codebase. I suggest naming potentially unsafe features "unsafeXxxx" just to discourage users unwilling to read into it and make sure if their use case is safe. For merging, a quick update to tests, a mention in changelog-unreleased and a mention in the sync docs would be highly appreciated. PS. Good luck with the app! |
if this flag is set to true, pullChanges is expected to be an AsyncGenerator that yields multiple SyncPullResults pullChanges is expected to be an AsyncGenerator that yields multiple SyncPullResults.
- fix a few implementation issues that were causing tests to fail - fix type definitions I broke - add support for async generators to babel
Hi @radex Progress update from me:
Things left to do:
If you have time, please can you provide feedback on the following:
|
I would consider this. While I love the fast-async project, unfortunately it's not super popular, and the complexity of Watermelon's babel config makes maintenance much more difficult. But if you found another solution, that's fine too.
I'm fine with |
Hi @radex,
I was wondering if doing something like as proposed in my draft PR would work for facilitating "chunked" pulls. I want to avoid a scenario where we have to hold the entire changeset in memory (as in our specific use-case, the amount of changes could be very large) (see: #650)
All I did was add an optional (useGenerator : boolean) parameter. When true, the pullChanges method instead returns an AsyncGenerator, yielding "chunks" of pulled changes vs. the entire payload at once. I've then just naively placed all code that persists/commits these changes into a loop - that runs for each chunk...
My peanut brain can't come up with any reasons why this shouldn't work - but was hoping you could provide some wisdom as to why/how this approach is flawed.
Many Thanks!
Tim