-
Notifications
You must be signed in to change notification settings - Fork 190
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
fix(torii-grpc): event processing subscription #2975
Conversation
WalkthroughOhayo, sensei! The changes involve adding a filtering mechanism in the Changes
The change is a simple yet effective data cleaning step that prevents processing of empty string results from splitting operations. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/torii/grpc/src/server/subscriptions/event.rs (1)
99-111
: Consider enhancing error reporting for debugging.Ohayo sensei! While the filtering approach is solid, consider adding debug logging when empty strings are filtered out. This could help diagnose issues if the input data quality degrades.
Here's a suggested enhancement:
.split(SQL_FELT_DELIMITER) - .filter(|s| !s.is_empty()) + .filter(|s| { + if s.is_empty() { + trace!(target = LOG_TARGET, "Filtered empty string in keys"); + false + } else { + true + } + }) .map(Felt::from_str) .collect::<Result<Vec<_>, _>>() .map_err(ParseError::from)?; let data = event .data .trim_end_matches(SQL_FELT_DELIMITER) .split(SQL_FELT_DELIMITER) - .filter(|s| !s.is_empty()) + .filter(|s| { + if s.is_empty() { + trace!(target = LOG_TARGET, "Filtered empty string in data"); + false + } else { + true + } + })
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/torii/grpc/src/server/subscriptions/event.rs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: ensure-wasm
- GitHub Check: build
- GitHub Check: clippy
- GitHub Check: docs
🔇 Additional comments (2)
crates/torii/grpc/src/server/subscriptions/event.rs (2)
100-100
: Ohayo! Good defensive programming, sensei!Adding the filter to remove empty strings before converting to
Felt
is a robust approach. This prevents potential parsing errors from empty strings in thekeys
field.
108-108
: Nice consistency in error handling!The same filtering approach is correctly applied to the
data
field, maintaining consistency in how empty strings are handled.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2975 +/- ##
==========================================
- Coverage 57.20% 57.12% -0.08%
==========================================
Files 423 424 +1
Lines 56125 56200 +75
==========================================
- Hits 32104 32103 -1
- Misses 24021 24097 +76 ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit