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

Schedule next request to get data after previous request finishes #1352

Merged
merged 5 commits into from
May 6, 2024

Conversation

jerelmiller
Copy link
Member

Small optimization to only trigger a new fetch of data after the previous completes. In case we are dealing with large payloads that take a significant amount of time to copy over, this prevents us from potentially overlapping the next request before the previous finishes.

@jerelmiller jerelmiller requested a review from a team as a code owner May 6, 2024 02:51
Copy link

relativeci bot commented May 6, 2024

#298 Bundle Size — 889.98KiB (0%).

2d2c112(current) vs 3aba499 main#294(baseline)

Warning

Bundle contains 31 duplicate packages – View duplicate packages

Bundle metrics  no changes
                 Current
#298
     Baseline
#294
No change  Initial JS 852.58KiB 852.58KiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 86.91%
No change  Chunks 5 5
No change  Assets 12 12
No change  Modules 680 680
No change  Duplicate Modules 35 35
No change  Duplicate Code 4.72% 4.72%
No change  Packages 96 96
No change  Duplicate Packages 30 30
Bundle size by type  no changes
                 Current
#298
     Baseline
#294
No change  JS 852.58KiB 852.58KiB
No change  IMG 35.85KiB 35.85KiB
No change  HTML 810B 810B
No change  Other 778B 778B

Bundle analysis reportBranch jerel/request-intervalProject dashboard

@@ -98,14 +98,15 @@ function startRequestInterval(ms = 500) {
payload: await rpcClient.request("getClientOperations"),
});
}

id = setTimeout(() => getClientData(), ms);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
id = setTimeout(() => getClientData(), ms);
id = setTimeout(getClientData, ms);

I think we don't need the function definition here

Copy link
Member

Choose a reason for hiding this comment

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

Also, should we wrap the whole block in try..finally to ensure an exception doesn't break the loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats a good idea!

@jerelmiller jerelmiller merged commit 2761ff3 into main May 6, 2024
9 checks passed
@jerelmiller jerelmiller deleted the jerel/request-interval branch May 6, 2024 15:01
@github-actions github-actions bot mentioned this pull request May 6, 2024
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.

None yet

2 participants