-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(rules): Don't pass buffer to apply_delayed #69700
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
Conversation
| for rulegroup_to_event in rulegroup_to_events: | ||
| for rule_group in rulegroup_to_event.keys(): | ||
| rule_id, group_id = rule_group.split(":") | ||
| rule_id, group_id = rule_group.decode("utf-8").split(":") |
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.
Why do we need to decode here? If this is bytes, we should change the type of rulegroup_to_events. But it might be better to change get_hash to perform the decoding instead?
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.
Yeah it's bytes, this was wrong before probably because we were mocking the return value so it was missed.
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.
Ok I addressed this and also the fact that redis returns stuff in a list and we're always accessing the 0 index by doing the decoding and indexing in the buffer so it's cleaner to use later on
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #69700 +/- ##
===========================================
+ Coverage 57.90% 79.84% +21.94%
===========================================
Files 6460 6469 +9
Lines 287234 287692 +458
Branches 49525 49586 +61
===========================================
+ Hits 166333 229721 +63388
+ Misses 120504 57579 -62925
+ Partials 397 392 -5
|
| ) -> dict[str, str]: | ||
| key = self._make_key(model, field) | ||
| return self._execute_redis_operation(key, RedisOperation.HASH_GET_ALL) | ||
| redis_hash = self._execute_redis_operation(key, RedisOperation.HASH_GET_ALL) |
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.
I wonder if we should also have _execute_redis_operation only return a single value. We always either make one call in the pipeline, or a second call to set expire, but I don't know that we ever care about the result of that second call?
Might be a nicer interface to just return the value of the operation you requested
Follow up to comments on #69167 to not pass the Redis buffer to
apply_delayed, and also a minor comment to rename a function.