mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
removed debug printing
This commit is contained in:
parent
cd348b5a0c
commit
34c30d492d
1 changed files with 0 additions and 11 deletions
11
process.go
11
process.go
|
@ -355,10 +355,8 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
// compression is not used it is the gob encoded data we already
|
||||
// got in msgData so we do nothing with it.
|
||||
if val, ok := msg.Header["cmp"]; ok {
|
||||
// fmt.Printf(" * DEBUG: ok = %v, map = %v, len of val = %v\n", ok, msg.Header, len(val))
|
||||
switch val[0] {
|
||||
case "z":
|
||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Compress got z for message of type: %v\n", p.subject.name())
|
||||
zr, err := zstd.NewReader(nil)
|
||||
if err != nil {
|
||||
log.Printf("error: zstd NewReader failed: %v\n", err)
|
||||
|
@ -376,7 +374,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
zr.Close()
|
||||
|
||||
case "g":
|
||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Compress got g for message of type: %v\n", p.subject.name())
|
||||
r := bytes.NewReader(msgData)
|
||||
gr, err := gzip.NewReader(r)
|
||||
if err != nil {
|
||||
|
@ -404,7 +401,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 "cbor":
|
||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Found serial header with cbor for message of type: %v\n", p.subject.name())
|
||||
err := cbor.Unmarshal(msgData, &message)
|
||||
if err != nil {
|
||||
er := fmt.Errorf("error: cbor decoding failed: %v", err)
|
||||
|
@ -413,7 +409,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
return
|
||||
}
|
||||
default: // Deaults to gob if no match was found.
|
||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Found serial header, but cbor not defined for message of type: %v, defaulting to GOB\n", p.subject.name())
|
||||
r := bytes.NewReader(msgData)
|
||||
gobDec := gob.NewDecoder(r)
|
||||
|
||||
|
@ -426,7 +421,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
|||
}
|
||||
|
||||
} else {
|
||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Found NO serial header for message of type: %v\n", p.subject.name())
|
||||
// Default to gob if serialization flag was not specified.
|
||||
r := bytes.NewReader(msgData)
|
||||
gobDec := gob.NewDecoder(r)
|
||||
|
@ -642,7 +636,6 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
|||
|
||||
natsMsgPayloadSerialized = b
|
||||
natsMsgHeader["serial"] = []string{p.configuration.Serialization}
|
||||
fmt.Printf(" * DEBUG: PUBLISHING: set CBOR for message of type: %v\n", p.subject.name())
|
||||
|
||||
default:
|
||||
var bufGob bytes.Buffer
|
||||
|
@ -656,7 +649,6 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
|||
|
||||
natsMsgPayloadSerialized = bufGob.Bytes()
|
||||
natsMsgHeader["serial"] = []string{"gob"}
|
||||
fmt.Printf(" * DEBUG: PUBLISHING: no serialization flag specified, set GOB for message of type: %v\n", p.subject.name())
|
||||
}
|
||||
|
||||
// Get the process name so we can look up the process in the
|
||||
|
@ -679,7 +671,6 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
|||
natsMsgHeader["cmp"] = []string{p.configuration.Compression}
|
||||
|
||||
zEnc.Reset(nil)
|
||||
fmt.Printf(" * DEBUG: PUBLISHING: compression got z, set %v for message of type: %v\n", "z", p.subject.name())
|
||||
|
||||
case "g": // gzip
|
||||
var buf bytes.Buffer
|
||||
|
@ -694,12 +685,10 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
|||
|
||||
natsMsgPayloadCompressed = buf.Bytes()
|
||||
natsMsgHeader["cmp"] = []string{p.configuration.Compression}
|
||||
fmt.Printf(" * DEBUG: PUBLISHING: compression got g, set %v for message of type: %v\n", p.configuration.Compression, p.subject.name())
|
||||
|
||||
case "": // no compression
|
||||
natsMsgPayloadCompressed = natsMsgPayloadSerialized
|
||||
natsMsgHeader["cmp"] = []string{"none"}
|
||||
fmt.Printf(" * DEBUG: PUBLISHING: Compress got \"\" for publishing: set %v for message of type: %v\n", "none", p.subject.name())
|
||||
|
||||
default: // no compression
|
||||
// Allways log the error to console.
|
||||
|
|
Loading…
Reference in a new issue