Skip to content

Commit 2d7f233

Browse files
committed
*: remove deprecated features
1 parent 866aa08 commit 2d7f233

File tree

23 files changed

+142
-704
lines changed

23 files changed

+142
-704
lines changed

apps/nsq_stat/nsq_stat.go

-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var (
2525
showVersion = flag.Bool("version", false, "print version")
2626
topic = flag.String("topic", "", "NSQ topic")
2727
channel = flag.String("channel", "", "NSQ channel")
28-
statusEvery = flag.Duration("status-every", -1, "(deprecated) duration of time between polling/printing output")
2928
interval = flag.Duration("interval", 2*time.Second, "duration of time between polling/printing output")
3029
httpConnectTimeout = flag.Duration("http-client-connect-timeout", 2*time.Second, "timeout for HTTP connect")
3130
httpRequestTimeout = flag.Duration("http-client-request-timeout", 5*time.Second, "timeout for HTTP request")
@@ -143,10 +142,6 @@ func main() {
143142
}
144143

145144
intvl := *interval
146-
if *statusEvery != -1 {
147-
log.Printf("--status-every is deprecated, use --interval")
148-
intvl = *statusEvery
149-
}
150145
if int64(intvl) <= 0 {
151146
log.Fatal("--interval should be positive")
152147
}

apps/nsq_tail/nsq_tail.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ func (th *TailHandler) HandleMessage(m *nsq.Message) error {
5555

5656
func main() {
5757
cfg := nsq.NewConfig()
58-
// TODO: remove, deprecated
59-
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
60-
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
6158

59+
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
6260
flag.Parse()
6361

6462
if *showVersion {

apps/nsq_to_file/nsq_to_file.go

+2-23
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ var (
5151
nsqdTCPAddrs = app.StringArray{}
5252
lookupdHTTPAddrs = app.StringArray{}
5353
topics = app.StringArray{}
54-
55-
// TODO: remove, deprecated
56-
gzipCompression = flag.Int("gzip-compression", 3, "(deprecated) use --gzip-level, gzip compression level (1 = BestSpeed, 2 = BestCompression, 3 = DefaultCompression)")
5754
)
5855

5956
func init() {
@@ -313,13 +310,12 @@ func (f *FileLogger) updateFile() {
313310
}
314311

315312
func NewFileLogger(gzipEnabled bool, compressionLevel int, filenameFormat, topic string) (*FileLogger, error) {
316-
// TODO: remove, deprecated, for compat <GZIPREV>
317-
filenameFormat = strings.Replace(filenameFormat, "<GZIPREV>", "<REV>", -1)
318313
if gzipEnabled || *rotateSize > 0 || *rotateInterval > 0 {
319314
if strings.Index(filenameFormat, "<REV>") == -1 {
320315
return nil, errors.New("missing <REV> in --filename-format when gzip or rotation enabled")
321316
}
322-
} else { // remove <REV> as we don't need it
317+
} else {
318+
// remove <REV> as we don't need it
323319
filenameFormat = strings.Replace(filenameFormat, "<REV>", "", -1)
324320
}
325321

@@ -467,10 +463,7 @@ func (t *TopicDiscoverer) watch(addrs []string, sync bool, pattern string,
467463
func main() {
468464
cfg := nsq.NewConfig()
469465

470-
// TODO: remove, deprecated
471-
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
472466
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
473-
474467
flag.Parse()
475468

476469
if *showVersion {
@@ -505,20 +498,6 @@ func main() {
505498
log.Fatalf("invalid --gzip-level value (%d), should be 1-9", *gzipLevel)
506499
}
507500

508-
// TODO: remove, deprecated
509-
if hasArg("gzip-compression") {
510-
log.Printf("WARNING: --gzip-compression is deprecated in favor of --gzip-level")
511-
switch *gzipCompression {
512-
case 1:
513-
*gzipLevel = gzip.BestSpeed
514-
case 2:
515-
*gzipLevel = gzip.BestCompression
516-
case 3:
517-
*gzipLevel = gzip.DefaultCompression
518-
default:
519-
log.Fatalf("invalid --gzip-compression value (%d), should be 1,2,3", *gzipCompression)
520-
}
521-
}
522501

523502
cfg.UserAgent = fmt.Sprintf("nsq_to_file/%s go-nsq/%s", version.Binary, nsq.VERSION)
524503
cfg.MaxInFlight = *maxInFlight

apps/nsq_to_http/nsq_to_http.go

+4-48
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ var (
4040
maxInFlight = flag.Int("max-in-flight", 200, "max number of messages to allow in flight")
4141

4242
numPublishers = flag.Int("n", 100, "number of concurrent publishers")
43-
mode = flag.String("mode", "hostpool", "the upstream request mode options: multicast, round-robin, hostpool (default), epsilon-greedy")
43+
mode = flag.String("mode", "hostpool", "the upstream request mode options: round-robin, hostpool (default), epsilon-greedy")
4444
sample = flag.Float64("sample", 1.0, "% of messages to publish (float b/w 0 -> 1)")
45-
// TODO: remove; deprecated in favor of http-client-connect-timeout, http-client-request-timeout
46-
httpTimeout = flag.Duration("http-timeout", 20*time.Second, "timeout for HTTP connect/read/write (each)")
4745
httpConnectTimeout = flag.Duration("http-client-connect-timeout", 2*time.Second, "timeout for HTTP connect")
4846
httpRequestTimeout = flag.Duration("http-client-request-timeout", 20*time.Second, "timeout for HTTP request")
4947
statusEvery = flag.Int("status-every", 250, "the # of requests between logging status (per handler), 0 disables")
@@ -53,12 +51,6 @@ var (
5351
postAddrs = app.StringArray{}
5452
nsqdTCPAddrs = app.StringArray{}
5553
lookupdHTTPAddrs = app.StringArray{}
56-
57-
// TODO: remove, deprecated
58-
roundRobin = flag.Bool("round-robin", false, "(deprecated) use --mode=round-robin, enable round robin mode")
59-
maxBackoffDuration = flag.Duration("max-backoff-duration", 120*time.Second, "(deprecated) use --consumer-opt=max_backoff_duration,X")
60-
throttleFraction = flag.Float64("throttle-fraction", 1.0, "(deprecated) use --sample=X, publish only a fraction of messages")
61-
httpTimeoutMs = flag.Int("http-timeout-ms", 20000, "(deprecated) use --http-timeout=X, timeout for HTTP connect/read/write (each)")
6254
)
6355

6456
func init() {
@@ -170,15 +162,13 @@ func hasArg(s string) bool {
170162
}
171163

172164
func main() {
173-
cfg := nsq.NewConfig()
174-
// TODO: remove, deprecated
175-
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
176-
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
177-
178165
var publisher Publisher
179166
var addresses app.StringArray
180167
var selectedMode int
181168

169+
cfg := nsq.NewConfig()
170+
171+
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
182172
flag.Parse()
183173

184174
if *showVersion {
@@ -221,44 +211,16 @@ func main() {
221211
}
222212

223213
switch *mode {
224-
case "multicast":
225-
log.Printf("WARNING: multicast mode is deprecated in favor of using separate nsq_to_http on different channels (and will be dropped in a future release)")
226-
selectedMode = ModeAll
227214
case "round-robin":
228215
selectedMode = ModeRoundRobin
229216
case "hostpool", "epsilon-greedy":
230217
selectedMode = ModeHostPool
231218
}
232219

233-
// TODO: remove, deprecated
234-
if hasArg("--round-robin") {
235-
log.Printf("WARNING: --round-robin is deprecated in favor of --mode=round-robin")
236-
selectedMode = ModeRoundRobin
237-
}
238-
239-
// TODO: remove, deprecated
240-
if hasArg("throttle-fraction") {
241-
log.Printf("WARNING: --throttle-fraction is deprecatedin favor of --sample=X")
242-
*sample = *throttleFraction
243-
}
244-
245220
if *sample > 1.0 || *sample < 0.0 {
246221
log.Fatal("ERROR: --sample must be between 0.0 and 1.0")
247222
}
248223

249-
// TODO: remove, deprecated
250-
if hasArg("http-timeout-ms") {
251-
log.Printf("WARNING: --http-timeout-ms is deprecated in favor of --http-timeout=X")
252-
*httpTimeout = time.Duration(*httpTimeoutMs) * time.Millisecond
253-
}
254-
255-
// TODO: remove, deprecated
256-
if hasArg("http-timeout") {
257-
log.Printf("WARNING: --http-timeout is deprecated in favor of --http-client-connect-timeout=X and --http-client-request-timeout=Y")
258-
*httpConnectTimeout = *httpTimeout
259-
*httpRequestTimeout = *httpTimeout
260-
}
261-
262224
termChan := make(chan os.Signal, 1)
263225
signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)
264226

@@ -273,12 +235,6 @@ func main() {
273235
cfg.UserAgent = fmt.Sprintf("nsq_to_http/%s go-nsq/%s", version.Binary, nsq.VERSION)
274236
cfg.MaxInFlight = *maxInFlight
275237

276-
// TODO: remove, deprecated
277-
if hasArg("max-backoff-duration") {
278-
log.Printf("WARNING: --max-backoff-duration is deprecated in favor of --consumer-opt=max_backoff_duration,X")
279-
cfg.MaxBackoffDuration = *maxBackoffDuration
280-
}
281-
282238
consumer, err := nsq.NewConsumer(*topic, *channel, cfg)
283239
if err != nil {
284240
log.Fatal(err)

apps/nsq_to_nsq/nsq_to_nsq.go

-11
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ var (
4848

4949
requireJSONField = flag.String("require-json-field", "", "for JSON messages: only pass messages that contain this field")
5050
requireJSONValue = flag.String("require-json-value", "", "for JSON messages: only pass messages in which the required field has this value")
51-
52-
// TODO: remove, deprecated
53-
maxBackoffDuration = flag.Duration("max-backoff-duration", 120*time.Second, "(deprecated) use --consumer-opt=max_backoff_duration,X")
5451
)
5552

5653
func init() {
@@ -270,8 +267,6 @@ func main() {
270267
cCfg := nsq.NewConfig()
271268
pCfg := nsq.NewConfig()
272269

273-
// TODO: remove, deprecated
274-
flag.Var(&nsq.ConfigFlag{cCfg}, "reader-opt", "(deprecated) use --consumer-opt")
275270
flag.Var(&nsq.ConfigFlag{cCfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, see http://godoc.org/github.com/nsqio/go-nsq#Config)")
276271
flag.Var(&nsq.ConfigFlag{pCfg}, "producer-opt", "option to passthrough to nsq.Producer (may be given multiple times, see http://godoc.org/github.com/nsqio/go-nsq#Config)")
277272

@@ -328,12 +323,6 @@ func main() {
328323
cCfg.UserAgent = defaultUA
329324
cCfg.MaxInFlight = *maxInFlight
330325

331-
// TODO: remove, deprecated
332-
if hasArg("max-backoff-duration") {
333-
log.Printf("WARNING: --max-backoff-duration is deprecated in favor of --consumer-opt=max_backoff_duration,X")
334-
cCfg.MaxBackoffDuration = *maxBackoffDuration
335-
}
336-
337326
consumer, err := nsq.NewConsumer(*topic, *channel, cCfg)
338327
if err != nil {
339328
log.Fatal(err)

apps/nsqadmin/main.go

-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var (
2323
showVersion = flagSet.Bool("version", false, "print version string")
2424

2525
httpAddress = flagSet.String("http-address", "0.0.0.0:4171", "<addr>:<port> to listen on for HTTP clients")
26-
templateDir = flagSet.String("template-dir", "", "path to templates directory")
2726

2827
graphiteURL = flagSet.String("graphite-url", "", "graphite HTTP address")
2928
proxyGraphite = flagSet.Bool("proxy-graphite", false, "proxy HTTP requests to graphite")
@@ -61,10 +60,6 @@ func main() {
6160
return
6261
}
6362

64-
if *templateDir != "" {
65-
log.Printf("WARNING: --template-dir is deprecated and will be removed in the next release (templates are now compiled into the binary)")
66-
}
67-
6863
exitChan := make(chan int)
6964
signalChan := make(chan os.Signal, 1)
7065
go func() {

apps/nsqd/nsqd.go

-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ func nsqdFlagSet(opts *nsqd.Options) *flag.FlagSet {
105105
flagSet.Duration("max-msg-timeout", opts.MaxMsgTimeout, "maximum duration before a message will timeout")
106106
flagSet.Int64("max-msg-size", opts.MaxMsgSize, "maximum size of a single message in bytes")
107107
flagSet.Duration("max-req-timeout", opts.MaxReqTimeout, "maximum requeuing timeout for a message")
108-
// remove, deprecated
109-
flagSet.Int64("max-message-size", opts.MaxMsgSize, "(deprecated use --max-msg-size) maximum size of a single message in bytes")
110108
flagSet.Int64("max-body-size", opts.MaxBodySize, "maximum size of a single command body")
111109

112110
// client overridable configuration options

bench/bench_channels/bench_channels.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ func subWorker(n int, tcpAddr string,
4646
conn.Write(nsq.MagicV2)
4747
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
4848
ci := make(map[string]interface{})
49-
ci["short_id"] = "test"
50-
ci["long_id"] = "test"
49+
ci["client_id"] = "test"
5150
cmd, _ := nsq.Identify(ci)
5251
cmd.WriteTo(rw)
5352
nsq.Subscribe(topic, channel).WriteTo(rw)

bench/bench_reader/bench_reader.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ func subWorker(td time.Duration, workers int, tcpAddr string, topic string, chan
7575
conn.Write(nsq.MagicV2)
7676
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
7777
ci := make(map[string]interface{})
78-
ci["short_id"] = "test"
79-
ci["long_id"] = "test"
78+
ci["client_id"] = "test"
8079
cmd, _ := nsq.Identify(ci)
8180
cmd.WriteTo(rw)
8281
nsq.Subscribe(topic, channel).WriteTo(rw)

0 commit comments

Comments
 (0)