Skip to content
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

instantaneous sync can cause outbox to have incorrect state #102

Closed
sheppard opened this issue Jan 18, 2018 · 1 comment
Closed

instantaneous sync can cause outbox to have incorrect state #102

sheppard opened this issue Jan 18, 2018 · 1 comment

Comments

@sheppard
Copy link
Member

So far this has only surfaced in the test environment (where network traffic is effectively instant). The process is something like this:

  1. Store two or more unrelated records in the outbox while offline (or with backgroundSync set to -1)
  2. Trigger the sync. Since the records are unrelated (i.e. no foreign keys to each other), they are sent in parallel.
  3. When the sync completes, both calls to sendItem() retrieve and update the outbox state for their respective item.
  4. If the records are successfully synced within milliseconds of each other, the last write to the outbox will overwrite the previous one.
  5. Thus, only one of the records is marked as synced, when actually both were successful.

This can be "fixed" in the test environment by adding a small delay to the test server (45cd0c3).

Some better options include;

@sheppard
Copy link
Member Author

This will be fixed by using redux-offline (#105).

@sheppard sheppard added this to the 1.2 - Redux Integration milestone Aug 8, 2019
sheppard added a commit that referenced this issue Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant