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

sendState should behave asynchronously #134

Open
cahirodoherty-learningpool opened this issue Oct 25, 2024 · 4 comments · May be fixed by #135
Open

sendState should behave asynchronously #134

cahirodoherty-learningpool opened this issue Oct 25, 2024 · 4 comments · May be fixed by #135
Assignees

Comments

@cahirodoherty-learningpool
Copy link
Contributor

Subject of the issue/enhancement/features

We have a custom plugin that forces submit of multiple components in one functional batch
(In essence:

        componentView.onSubmitClicked();
      });

)

When it comes to handling a large volume of components, we have found that this effectively creates a race condition and the state that comes back may actually not be the last state sent, thus cutting off some question values when the state is loaded again on subsequent views.

I believe setting an await on https://github.com/adaptlearning/adapt-contrib-xapi/blob/master/js/XAPI.js#L1082 should help us out in this regard

@cahirodoherty-learningpool
Copy link
Contributor Author

@oliverfoster Any thoughts on this?

@oliverfoster
Copy link
Member

oliverfoster commented Nov 4, 2024

The state is concurrently read in once and updated multiple times?

How is an old state read in after an update is sent? What is the exact mechanism / order of flow?

Strategically, it's best usually to add a "last updated" timestamp on the state. Such that only states that are newer than the local/previous are accepted as updates and retries are attempted on conflict.

@cahirodoherty-learningpool
Copy link
Contributor Author

cahirodoherty-learningpool commented Nov 7, 2024

Basically its a one-button submit for all components:

onSubmit() {
    _.each(this.componentViews, (componentView) => {
        componentView.onSubmitClicked();
    });
}

@oliverfoster
Copy link
Member

Yes, I don't understand where a state is being read in and in conflict. I see that submitting multiple questions at the same time would rapidly send statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants