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

Do not update if there is a save pending #4842

Merged
merged 7 commits into from
Sep 24, 2024
Merged

Conversation

mwdchang
Copy link
Member

@mwdchang mwdchang commented Sep 19, 2024

Summary

This attempts to solve another round synchronization issue - the suspected culprits are the debouncers we are using for both saving-to-db and update-from-db going out of sync with each other. The primary reason for debouncers here is because we cannot send in a stream of updates across REST API without jamming-up every one else, so to resolve around that we introduce a couple of heuristics below.

To illustrate the potential sync problem:

  • Action 1: if we move operator-A, then
  • Action 2: link operator-A to operator-B
  • Action 1 is send to DB, and Action 2 is queued
    • As Action 2 is queued up, the response from Action 1 comes back and partially overwrite what we would've written with Action 2, at this point Action 2 is flushed tot he DB.

Heuristic 1: Do not update if there is a save action pending

Heuristic 2: Do not update if we are dragging

In both cases, we acknowledge there is an update by incrementing the version number, but skip over the fields. The idea is that, for

  • heuristic 1: there is a save in progress that will result in a update-from-db, we will use that one
  • heuristic 2: drag-end results in a save, which is heuristic 1

The assumption is that only a single user works on an operator at a time.

Relates to

Testing

This should remedy strange jerkiness/flickers, as well as weird connection states between operator ports.

@mwdchang mwdchang marked this pull request as ready for review September 23, 2024 22:05
Copy link
Contributor

@Tom-Szendrey Tom-Szendrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@mwdchang mwdchang merged commit c42e16e into main Sep 24, 2024
4 checks passed
@mwdchang mwdchang deleted the save-upload-sync-fix branch September 24, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants