-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Исправить подсчет времени выполнения запросов в батче #230
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leshchenko1979 - I've reviewed your changes and they look great!
General suggestions:
- Consider adding comprehensive error handling within the new 'add_throttler_records' method to ensure robustness in face of unexpected JSON structures.
- Simplify the 'add_throttler_records' method to improve code maintainability and readability, potentially by reducing branching logic and focusing on core functionality.
- Review the newly introduced warnings for parameter misuse to ensure they are clear and actionable for the users.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
def add_throttler_records(self, method, params: dict, json: dict): | ||
if "result_time" in json: | ||
for cmd_name, cmd_url in params["cmd"].items(): | ||
item_method = cmd_url.split("?")[0] | ||
item_time = json["result_time"][cmd_name] | ||
self.method_throttlers[item_method].add_request_record(item_time) | ||
else: | ||
request_run_time = json["time"]["operating"] | ||
self.method_throttlers[method].add_request_record(request_run_time) | ||
|
||
self.leaky_bucket_throttler.add_request_record() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (edge_case_not_handled): Ensure error handling in 'add_throttler_records' method.
Given the critical nature of throttling in API interactions, consider adding error handling within 'add_throttler_records' to manage unexpected 'json' structures or missing keys.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #230 +/- ##
==========================================
- Coverage 89.50% 88.68% -0.82%
==========================================
Files 11 11
Lines 581 592 +11
==========================================
+ Hits 520 525 +5
- Misses 61 67 +6 ☔ View full report in Codecov by Sentry. |
No description provided.