Skip to content

Optimize webhooks status subscriptions - #7428

Merged
KevinOConnor merged 3 commits into
masterfrom
work-webquery-20261022
Nov 28, 2026
Merged

KevinOConnor merged 3 commits into
masterfrom
work-webquery-20261022

Conversation

@KevinOConnor

Copy link
Copy Markdown
Collaborator

This is an alternative implementation of #7412 .

In a nutshell, almost all status updates are small as very few fields typically change in the 250ms between updates, so it is slightly more efficient to calculate the full set of changes upfront instead of calculating the changes for each client.

This PR would be something I'd look to merge after the next release is tagged.

-Kevin

@KevinOConnor
KevinOConnor force-pushed the work-webquery-20261022 branch from f44586e to 510f7a2 Compare November 10, 2026 18:52
@github-actions

Copy link
Copy Markdown

Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html

There are some steps that you can take now:

  1. Perform a self-review of your Pull Request by following the steps at: https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review
    If you have completed a self-review, be sure to state the results of that self-review explicitly in the Pull Request comments. A reviewer is more likely to participate if the bulk of a review has already been completed.
  2. Consider opening a topic on the Klipper Discourse server to discuss this work. The Discourse server is a good place to discuss development ideas and to engage users interested in testing. Reviewers are more likely to prioritize Pull Requests with an active community of users.
  3. Consider helping out reviewers by reviewing other Klipper Pull Requests. Taking the time to perform a careful and detailed review of others work is appreciated. Regular contributors are more likely to prioritize the contributions of other regular contributors.

Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

Determine the full set of printer objects to query and then query
those objects in separate stages from client processing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
…do_query()

There is no need for the self.pending_queries and self.clients member
variables to have the same internal format.  Process these requests in
two separate stages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
…uery()

In normal operation the amount of changed status information is likely
to be small.  It can be a little more efficient to calculate all the
changes once and then share those changes with each client instead of
recalculating the changes for each client.

Reported by @jolting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
@KevinOConnor
KevinOConnor force-pushed the work-webquery-20261022 branch from 510f7a2 to c8d9a79 Compare November 28, 2026 01:44
@KevinOConnor
KevinOConnor merged commit c8d9a79 into master Nov 28, 2026
2 checks passed
@KevinOConnor
KevinOConnor deleted the work-webquery-20261022 branch November 28, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant