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

Request batch when idle #7526

Merged
merged 35 commits into from
Mar 12, 2024
Merged

Request batch when idle #7526

merged 35 commits into from
Mar 12, 2024

Conversation

akhenry
Copy link
Contributor

@akhenry akhenry commented Feb 27, 2024

Closes akhenry/openmct-yamcs#424

Related branches

Describe your changes:

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes Notable Change ? For example, will this break compatibility with existing APIs or projects which source these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 19.82759% with 93 lines in your changes are missing coverage. Please review.

Project coverage is 55.29%. Comparing base (8c2558b) to head (a006dce).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7526      +/-   ##
==========================================
- Coverage   55.64%   55.29%   -0.35%     
==========================================
  Files         672      672              
  Lines       26996    27060      +64     
  Branches     2626     2626              
==========================================
- Hits        15023    14964      -59     
- Misses      11254    11373     +119     
- Partials      719      723       +4     
Flag Coverage Δ
e2e-full 23.60% <5.00%> (-18.25%) ⬇️
e2e-stable 59.65% <10.00%> (+0.05%) ⬆️
unit 48.40% <19.82%> (-0.13%) ⬇️
Files Coverage Δ
src/api/telemetry/TelemetryAPI.js 89.38% <100.00%> (+0.17%) ⬆️
src/plugins/LADTable/components/LadRow.vue 52.57% <ø> (ø)
src/plugins/LADTable/components/LadTable.vue 43.66% <100.00%> (ø)
...c/plugins/displayLayout/components/LayoutFrame.vue 0.00% <ø> (ø)
src/plugins/gauge/components/GaugeComponent.vue 61.49% <100.00%> (-0.58%) ⬇️
...c/plugins/openInNewTabAction/openInNewTabAction.js 100.00% <100.00%> (ø)
src/plugins/timeConductor/ConductorAxis.vue 24.27% <ø> (-1.45%) ⬇️
.../plugins/timeConductor/ConductorInputsRealtime.vue 70.42% <100.00%> (-1.41%) ⬇️
...plugins/displayLayout/components/TelemetryView.vue 2.40% <0.00%> (ø)
src/ui/components/ObjectFrame.vue 4.08% <0.00%> (ø)
... and 5 more

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c2558b...a006dce. Read the comment docs.

@@ -245,7 +245,6 @@ export default function installWorker() {
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will try and figure out how to get Webpack to inline Workers so we can do imports etc. Should not block merge right now, it's a no-risk maintenance change we can make later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some discussion on this here with some potential options - webpack/webpack#14066

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could happen post-merge as it's low risk. It either loads or doesn't.

@@ -352,6 +364,33 @@ export default function installWorker() {
}
}

function throttle(callback, wait) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed because can't import in workers with current build config.

@@ -33,6 +33,6 @@ export default class OpenInNewTab {
}
invoke(objectPath, urlParams = undefined) {
let url = objectPathToUrl(this._openmct, objectPath, urlParams);
window.open(url);
window.open(url, undefined, "noopener");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

noopener means that the new window/tab does not share the same event loop as the opening window. It makes debugging A LOT easier and probably gives a subtle performance boost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -498,11 +498,17 @@ export default {
},
created() {
this.filterTelemetry = _.debounce(this.filterTelemetry, 500);
const throttledFunc = _.throttle(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Call throttle callback on leading-edge so that screen update happens in same event loop iteration as telemetry receipt. Improves debugging and also means telemetry is not delayed an additional second beyond the delay created by telemetry batching.

},
mounted() {
this.csvExporter = new CSVExporter();
this.rowsAdded = _.throttle(this.rowsAdded, 200);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Throttling updateVisibleRows now, no need to also throttle rowsAdded and rowsRemoved

src/plugins/telemetryTable/components/TableComponent.vue Outdated Show resolved Hide resolved
src/plugins/telemetryTable/components/TableComponent.vue Outdated Show resolved Hide resolved
src/plugins/telemetryTable/components/TableRow.vue Outdated Show resolved Hide resolved
src/plugins/timeConductor/ConductorAxis.vue Outdated Show resolved Hide resolved
src/ui/components/TimeSystemAxis.vue Outdated Show resolved Hide resolved
@akhenry akhenry marked this pull request as ready for review February 29, 2024 23:59
Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

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

This all looks good.

During testing I found one issue - after websocket is disconnected (simulated by killing quickstart locally) and reconnects after a try or two, the remote clock doesn't tick anymore. I don't think this is related to the batching changes though?

image

src/api/telemetry/WebSocketWorker.js Show resolved Hide resolved
src/api/telemetry/WebSocketWorker.js Outdated Show resolved Hide resolved
@akhenry
Copy link
Contributor Author

akhenry commented Mar 4, 2024

During testing I found one issue - after websocket is disconnected (simulated by killing quickstart locally) and reconnects after a try or two, the remote clock doesn't tick anymore. I don't think this is related to the batching changes though?

Good catch, thanks, lemme take a look.

@akhenry
Copy link
Contributor Author

akhenry commented Mar 5, 2024

This all looks good.

During testing I found one issue - after websocket is disconnected (simulated by killing quickstart locally) and reconnects after a try or two, the remote clock doesn't tick anymore. I don't think this is related to the batching changes though?

This was a really good catch. There was some functionality missing to re-subscribe after a WebSocket drops, which was a bad miss on my part.

I've fixed the issue and added a test to catch a regression here.

Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

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

Looks good!

@akhenry
Copy link
Contributor Author

akhenry commented Mar 8, 2024

@shefalijoshi Addressed issue with requestIdleCallback. Thanks again!

Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@akhenry akhenry enabled auto-merge (squash) March 12, 2024 16:25
@akhenry akhenry added the pr:e2e:couchdb npm run test:e2e:couchdb label Mar 12, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Mar 12, 2024
@akhenry akhenry merged commit 5f0bd10 into master Mar 12, 2024
21 checks passed
@akhenry akhenry deleted the request-batch-when-idle branch March 12, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open MCT is client rate limiting too eagerly on load
3 participants