optimized image list interface

This commit is contained in:
2025-02-17 11:21:38 +08:00
parent ab4e9c4d59
commit b196e50aee
72 changed files with 1676 additions and 343 deletions

28
common/nsqx/nsq.go Normal file
View File

@@ -0,0 +1,28 @@
package nsqx
import (
"fmt"
"github.com/nsqio/go-nsq"
"time"
)
func NewNsqProducer(url string) *nsq.Producer {
producer, err := nsq.NewProducer(url, nsq.NewConfig())
if err != nil {
panic(err)
}
producer.SetLoggerLevel(nsq.LogLevelError)
return producer
}
func NewNSQConsumer(topic string) *nsq.Consumer {
config := nsq.NewConfig()
config.LookupdPollInterval = 15 * time.Second
consumer, err := nsq.NewConsumer(topic, "channel", config)
if err != nil {
fmt.Printf("InitNSQ consumer error: %v\n", err)
return nil
}
consumer.SetLoggerLevel(nsq.LogLevelError)
return consumer
}