忽略
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
package redis
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-redis/redis"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RedisPullStart(parse chan<- *string, client *redis.Client) {
|
||||
|
||||
pong, err := client.Ping().Result()
|
||||
|
||||
if err != nil {
|
||||
panic("redis连接失败")
|
||||
}
|
||||
|
||||
fmt.Println(pong, err)
|
||||
|
||||
for {
|
||||
|
||||
vals, err := client.BLPop(0, "filebeat").Result()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
|
||||
if len(vals) == 2 {
|
||||
parse <- &vals[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
package redis
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-redis/redis"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RedisPullStart(parse chan<- *string, client *redis.Client) {
|
||||
|
||||
pong, err := client.Ping().Result()
|
||||
|
||||
if err != nil {
|
||||
panic("redis连接失败")
|
||||
}
|
||||
|
||||
fmt.Println(pong, err)
|
||||
|
||||
for {
|
||||
|
||||
vals, err := client.BLPop(0, "filebeat").Result()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
|
||||
if len(vals) == 2 {
|
||||
parse <- &vals[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user