Skip to content

Commit

Permalink
*: remove deprecated features
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Dec 28, 2016
1 parent 866aa08 commit 2d7f233
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 704 deletions.
5 changes: 0 additions & 5 deletions apps/nsq_stat/nsq_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var (
showVersion = flag.Bool("version", false, "print version")
topic = flag.String("topic", "", "NSQ topic")
channel = flag.String("channel", "", "NSQ channel")
statusEvery = flag.Duration("status-every", -1, "(deprecated) duration of time between polling/printing output")
interval = flag.Duration("interval", 2*time.Second, "duration of time between polling/printing output")
httpConnectTimeout = flag.Duration("http-client-connect-timeout", 2*time.Second, "timeout for HTTP connect")
httpRequestTimeout = flag.Duration("http-client-request-timeout", 5*time.Second, "timeout for HTTP request")
Expand Down Expand Up @@ -143,10 +142,6 @@ func main() {
}

intvl := *interval
if *statusEvery != -1 {
log.Printf("--status-every is deprecated, use --interval")
intvl = *statusEvery
}
if int64(intvl) <= 0 {
log.Fatal("--interval should be positive")
}
Expand Down
4 changes: 1 addition & 3 deletions apps/nsq_tail/nsq_tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ func (th *TailHandler) HandleMessage(m *nsq.Message) error {

func main() {
cfg := nsq.NewConfig()
// TODO: remove, deprecated
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
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)")

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)")
flag.Parse()

if *showVersion {
Expand Down
25 changes: 2 additions & 23 deletions apps/nsq_to_file/nsq_to_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ var (
nsqdTCPAddrs = app.StringArray{}
lookupdHTTPAddrs = app.StringArray{}
topics = app.StringArray{}

// TODO: remove, deprecated
gzipCompression = flag.Int("gzip-compression", 3, "(deprecated) use --gzip-level, gzip compression level (1 = BestSpeed, 2 = BestCompression, 3 = DefaultCompression)")
)

func init() {
Expand Down Expand Up @@ -313,13 +310,12 @@ func (f *FileLogger) updateFile() {
}

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

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

// TODO: remove, deprecated
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
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)")

flag.Parse()

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

// TODO: remove, deprecated
if hasArg("gzip-compression") {
log.Printf("WARNING: --gzip-compression is deprecated in favor of --gzip-level")
switch *gzipCompression {
case 1:
*gzipLevel = gzip.BestSpeed
case 2:
*gzipLevel = gzip.BestCompression
case 3:
*gzipLevel = gzip.DefaultCompression
default:
log.Fatalf("invalid --gzip-compression value (%d), should be 1,2,3", *gzipCompression)
}
}

cfg.UserAgent = fmt.Sprintf("nsq_to_file/%s go-nsq/%s", version.Binary, nsq.VERSION)
cfg.MaxInFlight = *maxInFlight
Expand Down
52 changes: 4 additions & 48 deletions apps/nsq_to_http/nsq_to_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ var (
maxInFlight = flag.Int("max-in-flight", 200, "max number of messages to allow in flight")

numPublishers = flag.Int("n", 100, "number of concurrent publishers")
mode = flag.String("mode", "hostpool", "the upstream request mode options: multicast, round-robin, hostpool (default), epsilon-greedy")
mode = flag.String("mode", "hostpool", "the upstream request mode options: round-robin, hostpool (default), epsilon-greedy")
sample = flag.Float64("sample", 1.0, "% of messages to publish (float b/w 0 -> 1)")
// TODO: remove; deprecated in favor of http-client-connect-timeout, http-client-request-timeout
httpTimeout = flag.Duration("http-timeout", 20*time.Second, "timeout for HTTP connect/read/write (each)")
httpConnectTimeout = flag.Duration("http-client-connect-timeout", 2*time.Second, "timeout for HTTP connect")
httpRequestTimeout = flag.Duration("http-client-request-timeout", 20*time.Second, "timeout for HTTP request")
statusEvery = flag.Int("status-every", 250, "the # of requests between logging status (per handler), 0 disables")
Expand All @@ -53,12 +51,6 @@ var (
postAddrs = app.StringArray{}
nsqdTCPAddrs = app.StringArray{}
lookupdHTTPAddrs = app.StringArray{}

// TODO: remove, deprecated
roundRobin = flag.Bool("round-robin", false, "(deprecated) use --mode=round-robin, enable round robin mode")
maxBackoffDuration = flag.Duration("max-backoff-duration", 120*time.Second, "(deprecated) use --consumer-opt=max_backoff_duration,X")
throttleFraction = flag.Float64("throttle-fraction", 1.0, "(deprecated) use --sample=X, publish only a fraction of messages")
httpTimeoutMs = flag.Int("http-timeout-ms", 20000, "(deprecated) use --http-timeout=X, timeout for HTTP connect/read/write (each)")
)

func init() {
Expand Down Expand Up @@ -170,15 +162,13 @@ func hasArg(s string) bool {
}

func main() {
cfg := nsq.NewConfig()
// TODO: remove, deprecated
flag.Var(&nsq.ConfigFlag{cfg}, "reader-opt", "(deprecated) use --consumer-opt")
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)")

var publisher Publisher
var addresses app.StringArray
var selectedMode int

cfg := nsq.NewConfig()

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)")
flag.Parse()

if *showVersion {
Expand Down Expand Up @@ -221,44 +211,16 @@ func main() {
}

switch *mode {
case "multicast":
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)")
selectedMode = ModeAll
case "round-robin":
selectedMode = ModeRoundRobin
case "hostpool", "epsilon-greedy":
selectedMode = ModeHostPool
}

// TODO: remove, deprecated
if hasArg("--round-robin") {
log.Printf("WARNING: --round-robin is deprecated in favor of --mode=round-robin")
selectedMode = ModeRoundRobin
}

// TODO: remove, deprecated
if hasArg("throttle-fraction") {
log.Printf("WARNING: --throttle-fraction is deprecatedin favor of --sample=X")
*sample = *throttleFraction
}

if *sample > 1.0 || *sample < 0.0 {
log.Fatal("ERROR: --sample must be between 0.0 and 1.0")
}

// TODO: remove, deprecated
if hasArg("http-timeout-ms") {
log.Printf("WARNING: --http-timeout-ms is deprecated in favor of --http-timeout=X")
*httpTimeout = time.Duration(*httpTimeoutMs) * time.Millisecond
}

// TODO: remove, deprecated
if hasArg("http-timeout") {
log.Printf("WARNING: --http-timeout is deprecated in favor of --http-client-connect-timeout=X and --http-client-request-timeout=Y")
*httpConnectTimeout = *httpTimeout
*httpRequestTimeout = *httpTimeout
}

termChan := make(chan os.Signal, 1)
signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)

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

// TODO: remove, deprecated
if hasArg("max-backoff-duration") {
log.Printf("WARNING: --max-backoff-duration is deprecated in favor of --consumer-opt=max_backoff_duration,X")
cfg.MaxBackoffDuration = *maxBackoffDuration
}

consumer, err := nsq.NewConsumer(*topic, *channel, cfg)
if err != nil {
log.Fatal(err)
Expand Down
11 changes: 0 additions & 11 deletions apps/nsq_to_nsq/nsq_to_nsq.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ var (

requireJSONField = flag.String("require-json-field", "", "for JSON messages: only pass messages that contain this field")
requireJSONValue = flag.String("require-json-value", "", "for JSON messages: only pass messages in which the required field has this value")

// TODO: remove, deprecated
maxBackoffDuration = flag.Duration("max-backoff-duration", 120*time.Second, "(deprecated) use --consumer-opt=max_backoff_duration,X")
)

func init() {
Expand Down Expand Up @@ -270,8 +267,6 @@ func main() {
cCfg := nsq.NewConfig()
pCfg := nsq.NewConfig()

// TODO: remove, deprecated
flag.Var(&nsq.ConfigFlag{cCfg}, "reader-opt", "(deprecated) use --consumer-opt")
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)")
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)")

Expand Down Expand Up @@ -328,12 +323,6 @@ func main() {
cCfg.UserAgent = defaultUA
cCfg.MaxInFlight = *maxInFlight

// TODO: remove, deprecated
if hasArg("max-backoff-duration") {
log.Printf("WARNING: --max-backoff-duration is deprecated in favor of --consumer-opt=max_backoff_duration,X")
cCfg.MaxBackoffDuration = *maxBackoffDuration
}

consumer, err := nsq.NewConsumer(*topic, *channel, cCfg)
if err != nil {
log.Fatal(err)
Expand Down
5 changes: 0 additions & 5 deletions apps/nsqadmin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var (
showVersion = flagSet.Bool("version", false, "print version string")

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

graphiteURL = flagSet.String("graphite-url", "", "graphite HTTP address")
proxyGraphite = flagSet.Bool("proxy-graphite", false, "proxy HTTP requests to graphite")
Expand Down Expand Up @@ -61,10 +60,6 @@ func main() {
return
}

if *templateDir != "" {
log.Printf("WARNING: --template-dir is deprecated and will be removed in the next release (templates are now compiled into the binary)")
}

exitChan := make(chan int)
signalChan := make(chan os.Signal, 1)
go func() {
Expand Down
2 changes: 0 additions & 2 deletions apps/nsqd/nsqd.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ func nsqdFlagSet(opts *nsqd.Options) *flag.FlagSet {
flagSet.Duration("max-msg-timeout", opts.MaxMsgTimeout, "maximum duration before a message will timeout")
flagSet.Int64("max-msg-size", opts.MaxMsgSize, "maximum size of a single message in bytes")
flagSet.Duration("max-req-timeout", opts.MaxReqTimeout, "maximum requeuing timeout for a message")
// remove, deprecated
flagSet.Int64("max-message-size", opts.MaxMsgSize, "(deprecated use --max-msg-size) maximum size of a single message in bytes")
flagSet.Int64("max-body-size", opts.MaxBodySize, "maximum size of a single command body")

// client overridable configuration options
Expand Down
3 changes: 1 addition & 2 deletions bench/bench_channels/bench_channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func subWorker(n int, tcpAddr string,
conn.Write(nsq.MagicV2)
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
ci := make(map[string]interface{})
ci["short_id"] = "test"
ci["long_id"] = "test"
ci["client_id"] = "test"
cmd, _ := nsq.Identify(ci)
cmd.WriteTo(rw)
nsq.Subscribe(topic, channel).WriteTo(rw)
Expand Down
3 changes: 1 addition & 2 deletions bench/bench_reader/bench_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ func subWorker(td time.Duration, workers int, tcpAddr string, topic string, chan
conn.Write(nsq.MagicV2)
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
ci := make(map[string]interface{})
ci["short_id"] = "test"
ci["long_id"] = "test"
ci["client_id"] = "test"
cmd, _ := nsq.Identify(ci)
cmd.WriteTo(rw)
nsq.Subscribe(topic, channel).WriteTo(rw)
Expand Down
Loading

0 comments on commit 2d7f233

Please sign in to comment.