mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
zstd removed speedbestcompression opt
This commit is contained in:
parent
f6e667dd82
commit
c4aa08711a
1 changed files with 4 additions and 3 deletions
|
@ -362,7 +362,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
// fmt.Printf(" * DEBUG: ok = %v, map = %v, len of val = %v\n", ok, msg.Header, len(val))
|
||||
switch val[0] {
|
||||
case "z":
|
||||
fmt.Println(" ******** READING ZSTD ************")
|
||||
zr, err := zstd.NewReader(nil)
|
||||
if err != nil {
|
||||
log.Printf("error: zstd NewReader failed: %v\n", err)
|
||||
|
@ -380,7 +379,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
zr.Close()
|
||||
|
||||
case "g":
|
||||
fmt.Println(" ******** READING GZIP ************")
|
||||
r := bytes.NewReader(msgData)
|
||||
gr, err := gzip.NewReader(r)
|
||||
if err != nil {
|
||||
|
@ -575,7 +573,8 @@ func (p process) publishMessages(natsConn *nats.Conn) {
|
|||
// encoder for all messages.
|
||||
switch p.configuration.Compression {
|
||||
case "z": // zstd
|
||||
enc, err := zstd.NewWriter(nil, zstd.WithEncoderLevel(zstd.SpeedBestCompression))
|
||||
// enc, err := zstd.NewWriter(nil, zstd.WithEncoderLevel(zstd.SpeedBestCompression))
|
||||
enc, err := zstd.NewWriter(nil)
|
||||
if err != nil {
|
||||
log.Printf("error: zstd new encoder failed: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
@ -658,6 +657,8 @@ func (p process) publishMessages(natsConn *nats.Conn) {
|
|||
natsMsgPayloadCompressed = zEnc.EncodeAll(natsMsgPayloadSerialized, nil)
|
||||
natsMsgHeader["cmp"] = []string{p.configuration.Compression}
|
||||
|
||||
zEnc.Reset(nil)
|
||||
|
||||
case "g": // gzip
|
||||
var buf bytes.Buffer
|
||||
gzipW := gzip.NewWriter(&buf)
|
||||
|
|
Loading…
Reference in a new issue