mirror of
https://github.com/postmannen/ctrl.git
synced 2025-01-18 21:59:30 +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
|
// compression is not used it is the gob encoded data we already
|
||||||
// got in msgData so we do nothing with it.
|
// got in msgData so we do nothing with it.
|
||||||
if val, ok := msg.Header["cmp"]; ok {
|
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] {
|
switch val[0] {
|
||||||
case "z":
|
case "z":
|
||||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Compress got z for message of type: %v\n", p.subject.name())
|
|
||||||
zr, err := zstd.NewReader(nil)
|
zr, err := zstd.NewReader(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error: zstd NewReader failed: %v\n", err)
|
log.Printf("error: zstd NewReader failed: %v\n", err)
|
||||||
|
@ -376,7 +374,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
||||||
zr.Close()
|
zr.Close()
|
||||||
|
|
||||||
case "g":
|
case "g":
|
||||||
fmt.Printf(" * DEBUG: SUBSCRIBING: Compress got g for message of type: %v\n", p.subject.name())
|
|
||||||
r := bytes.NewReader(msgData)
|
r := bytes.NewReader(msgData)
|
||||||
gr, err := gzip.NewReader(r)
|
gr, err := gzip.NewReader(r)
|
||||||
if err != nil {
|
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))
|
// fmt.Printf(" * DEBUG: ok = %v, map = %v, len of val = %v\n", ok, msg.Header, len(val))
|
||||||
switch val[0] {
|
switch val[0] {
|
||||||
case "cbor":
|
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)
|
err := cbor.Unmarshal(msgData, &message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
er := fmt.Errorf("error: cbor decoding failed: %v", err)
|
er := fmt.Errorf("error: cbor decoding failed: %v", err)
|
||||||
|
@ -413,7 +409,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
default: // Deaults to gob if no match was found.
|
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)
|
r := bytes.NewReader(msgData)
|
||||||
gobDec := gob.NewDecoder(r)
|
gobDec := gob.NewDecoder(r)
|
||||||
|
|
||||||
|
@ -426,7 +421,6 @@ func (p process) messageSubscriberHandler(natsConn *nats.Conn, thisNode string,
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} 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.
|
// Default to gob if serialization flag was not specified.
|
||||||
r := bytes.NewReader(msgData)
|
r := bytes.NewReader(msgData)
|
||||||
gobDec := gob.NewDecoder(r)
|
gobDec := gob.NewDecoder(r)
|
||||||
|
@ -642,7 +636,6 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
||||||
|
|
||||||
natsMsgPayloadSerialized = b
|
natsMsgPayloadSerialized = b
|
||||||
natsMsgHeader["serial"] = []string{p.configuration.Serialization}
|
natsMsgHeader["serial"] = []string{p.configuration.Serialization}
|
||||||
fmt.Printf(" * DEBUG: PUBLISHING: set CBOR for message of type: %v\n", p.subject.name())
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
var bufGob bytes.Buffer
|
var bufGob bytes.Buffer
|
||||||
|
@ -656,7 +649,6 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
||||||
|
|
||||||
natsMsgPayloadSerialized = bufGob.Bytes()
|
natsMsgPayloadSerialized = bufGob.Bytes()
|
||||||
natsMsgHeader["serial"] = []string{"gob"}
|
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
|
// 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}
|
natsMsgHeader["cmp"] = []string{p.configuration.Compression}
|
||||||
|
|
||||||
zEnc.Reset(nil)
|
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
|
case "g": // gzip
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
@ -694,12 +685,10 @@ func (p process) publishAMessage(m Message, zEnc *zstd.Encoder, once sync.Once,
|
||||||
|
|
||||||
natsMsgPayloadCompressed = buf.Bytes()
|
natsMsgPayloadCompressed = buf.Bytes()
|
||||||
natsMsgHeader["cmp"] = []string{p.configuration.Compression}
|
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
|
case "": // no compression
|
||||||
natsMsgPayloadCompressed = natsMsgPayloadSerialized
|
natsMsgPayloadCompressed = natsMsgPayloadSerialized
|
||||||
natsMsgHeader["cmp"] = []string{"none"}
|
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
|
default: // no compression
|
||||||
// Allways log the error to console.
|
// Allways log the error to console.
|
||||||
|
|
Loading…
Add table
Reference in a new issue