-
Notifications
You must be signed in to change notification settings - Fork 40
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
async api handlers #1698
base: main
Are you sure you want to change the base?
async api handlers #1698
Conversation
Refactor the handling of api requests from interactives. The handlers can now be asynchronous. If an array of api requests is sent by the interactive they will be run one after the other which each waiting for the previous one to finish. Individual api requests will be run when they come in even if there is another api request or array of request waiting to finish. The api request loop is changed from an autorun based observer to a reaction observer. This way properties accessed by each handler are not observed. We only want to run the loop when a new request comes in, not when a property changes that a handler accessed.
codap-v3 Run #5600
Run Properties:
|
Project |
codap-v3
|
Branch Review |
188712457-async-api-handlers
|
Run status |
Passed #5600
|
Run duration | 01m 51s |
Commit |
32fc4536b8: async api handlers
|
Committer | Scott Cytacki |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
3
|
View all changes introduced in this branch ↗︎ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1698 +/- ##
===========================================
- Coverage 85.89% 68.46% -17.43%
===========================================
Files 607 607
Lines 31108 31112 +4
Branches 8643 8643
===========================================
- Hits 26720 21302 -5418
- Misses 4233 9655 +5422
Partials 155 155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@scytacki I tested the shared table plugin on this branch and things look like they're working correctly 👍 This is the plugin that required us to add the API request queue, which is blocked when a table is being edited. Here's how to test it if you want to see for yourself:
On the first computer, you should not see changes made on the second computer while you are actively editing the cell. When you finish editing the cell, all of the changes made on the second computer should appear. This is how the plugin is designed to work. |
Refactor the handling of api requests from interactives.
The handlers can now be asynchronous. If an array of api requests is sent by the interactive they will be run one after the other with each waiting for the previous one to finish.
Individual api requests will be run when they come in even if there is another api request or array of request waiting to finish.
The api request loop is changed from an autorun based observer to a reaction observer. This way properties accessed by each handler are not observed. We only want to run the loop when a new request comes in, not when a property changes that a handler accessed.
TODO:
incrementInterruptionCount
will called. This is becauseprocessItems
doesn't wait. However this whole approach does not seem async safe because additional requests might come and finish in while one is waiting.