-
Notifications
You must be signed in to change notification settings - Fork 3
Add --no-dedup flag to publish command #95
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
📝 WalkthroughWalkthroughAdds a Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (publish cmd)
participant API as Publish API (HTTP)
participant Broker as Broker / Deduper
CLI->>API: POST /publish { topic, message, timestamp? }
alt no-dedup == false
note right of CLI: timestamp = UnixMilli()
else no-dedup == true
note right of CLI: timestamp omitted (nil)
end
API->>Broker: deliver(message, timestamp?)
alt timestamp present
Broker->>Broker: use timestamp for dedup check
Broker-->>API: accepted (unique) / message_id
else timestamp absent
Broker->>Broker: treat as identical -> deduplicate based on content/other keys
Broker-->>API: deduplicated / same message_id
end
API-->>CLI: JSON { status, message_id }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
d26866e to
8987033
Compare
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.
add test for both true/false values
can we do that inprocess somehow ?
Walentalien
left a comment
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.
lets just close this pr and issue
Unless there is a reason why not
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/publish.go (1)
141-183: The--no-dedupflag is silently ignored when using--grpc.The gRPC path doesn't use the
noDedupflag, and based on the proto definition,PublishRequesthas noTimestampfield for gRPC. Users specifying--grpc --no-dedupmay expect the flag to take effect.Consider either:
- Logging a warning when both flags are used, or
- Documenting in the
--no-deduphelp text that it only applies to HTTPOption 1: Add a warning when both flags are used
if useGRPCPub { + if noDedup { + fmt.Fprintln(os.Stderr, "⚠️ Warning: --no-dedup has no effect with --grpc (gRPC does not use timestamp-based deduplication)") + } // gRPC publish logicOption 2: Update flag description
- publishCmd.Flags().BoolVar(&noDedup, "no-dedup", false, "Omit timestamp to use MsgHash(topic, message) instead of MsgHashWithTimestamp. Allows same message to be sent once per session (useful for stress testing/benchmarking)") + publishCmd.Flags().BoolVar(&noDedup, "no-dedup", false, "HTTP only: Omit timestamp to use MsgHash(topic, message) instead of MsgHashWithTimestamp. Allows same message to be sent once per session (useful for stress testing/benchmarking)")
Summary by CodeRabbit
New Features
Behavior Changes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.