Skip to content

feat(cli): add --retry option to override notification retry count - #884

Open
miladev95 wants to merge 1 commit into
appleboy:masterfrom
miladev95:feat/cli-retry-option
Open

miladev95 wants to merge 1 commit into
appleboy:masterfrom
miladev95:feat/cli-retry-option

Conversation

@miladev95

Copy link
Copy Markdown
Contributor

Summary

Adds a new --retry <count> CLI flag that lets users override the per-notification retry count when sending via the command line.

The REST API already supports a per-request retry field (PushNotification.Retry), which is honored by all three platforms (APNS, FCM, HMS) and capped by the configured max_retry. This change brings the same capability to CLI mode, which previously could only use the global max_retry config value.

Changes

  • app/options.go — add Retry field to Options, bind --retry flag, pass through CLISendOptions()
  • app/sender.go — set req.Retry in SendAndroidNotification, SendHuaweiNotification, and SendIOSNotification when --retry is > 0
  • main.go — document --retry in usage text
  • app/options_test.go, app/sender_test.go — tests for the new option and its default value

Usage

gorush --android --token TOKEN --message hi --retry 3

Notes

  • --retry 0 (default) is ignored, preserving existing behavior
  • Negative values are ignored, matching the REST API's handling of retry
  • No config schema changes required

Testing

  • go test -v -tags sqlite ./app/... — all tests pass
  • go build -tags sqlite . — builds successfully
  • golangci-lint run ./app/... — 0 issues

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.

1 participant