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

Run Limits Responses in Thread to Prevent Blocking Decom #1901

Merged
merged 5 commits into from
Feb 19, 2025

Conversation

ryanmelt
Copy link
Member

No description provided.

@ryanmelt ryanmelt requested a review from jmthomas February 15, 2025 04:03
Copy link

codecov bot commented Feb 15, 2025

Codecov Report

Attention: Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.56%. Comparing base (92b60ed) to head (c21fe82).
Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...nc3/lib/openc3/microservices/decom_microservice.rb 95.45% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1901      +/-   ##
==========================================
+ Coverage   79.42%   79.56%   +0.14%     
==========================================
  Files         523      523              
  Lines       40926    41040     +114     
==========================================
+ Hits        32506    32654     +148     
+ Misses       8420     8386      -34     
Flag Coverage Δ
python 84.14% <ø> (+0.17%) ⬆️
ruby-api 48.51% <ø> (+0.05%) ⬆️
ruby-backend 82.68% <96.55%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

self.logger.error(f"Called with old_state = {old_limits_state}, new_state = {item.limits.state}")
self.logger.error(repr(error))
copied_packet = packet.deep_copy()
copied_item = packet.items[item.name]
Copy link
Member

Choose a reason for hiding this comment

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

This is just a reference right? Should it be a copy()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because of the packet.deep_copy it is a reference to the correct new item.

self.logger.error(f"{packet.target_name} {packet.packet_name} {item.name} Limits Response Exception!")
self.logger.error(f"Called with old_state = {old_limits_state}, new_state = {item.limits.state}")
self.logger.error(repr(error))
copied_packet = packet.deep_copy()
Copy link
Member

Choose a reason for hiding this comment

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

Python already has deepcopy: https://docs.python.org/3/library/copy.html#copy.deepcopy. Should this just be packet.deepcopy?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. Its a "mostly" deep copy. At least in Ruby can't do a real deep copy because that would marshal Mutex which isn't allowed.

Copy link
Member

@jmthomas jmthomas left a comment

Choose a reason for hiding this comment

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

No unit tests?

@ryanmelt
Copy link
Member Author

Would love for someone else to add new unit tests if necessary. ;)

@jmthomas jmthomas self-requested a review February 18, 2025 22:46
Copy link
Member

@jmthomas jmthomas left a comment

Choose a reason for hiding this comment

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

Now with unit tests!

@jmthomas jmthomas merged commit 2c13970 into main Feb 19, 2025
29 of 30 checks passed
@jmthomas jmthomas deleted the limits_response_thread branch February 19, 2025 03:35
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.

2 participants