@@ -65,9 +65,7 @@ func New(rootLogger *logrus.Logger, cfg *config.Gateway, r *Router) *Gateway {
6565// FindCanonicalMsgID returns the ID under which a message was stored in the cache.
6666func (gw * Gateway ) FindCanonicalMsgID (protocol string , mID string ) string {
6767 ID := protocol + " " + mID
68- gw .logger .Debugf ("FindCanonicalMsgID: looking for ID=%s in cache (cache has %d entries)" , ID , gw .Messages .Len ())
6968 if gw .Messages .Contains (ID ) {
70- gw .logger .Debugf ("FindCanonicalMsgID: found ID=%s directly in cache" , ID )
7169 return ID
7270 }
7371
@@ -77,12 +75,10 @@ func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
7775 ids := v .([]* BrMsgID )
7876 for _ , downstreamMsgObj := range ids {
7977 if ID == downstreamMsgObj .ID {
80- gw .logger .Debugf ("FindCanonicalMsgID: found ID=%s as downstream of canonical=%s" , ID , mid .(string ))
8178 return mid .(string )
8279 }
8380 }
8481 }
85- gw .logger .Debugf ("FindCanonicalMsgID: ID=%s not found in cache" , ID )
8682 return ""
8783}
8884
@@ -263,23 +259,15 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
263259}
264260
265261func (gw * Gateway ) getDestMsgID (msgID string , dest * bridge.Bridge , channel * config.ChannelInfo ) string {
266- gw .logger .Debugf ("getDestMsgID: looking for msgID=%s, dest.Protocol=%s, dest.Name=%s, channel.ID=%s" , msgID , dest .Protocol , dest .Name , channel .ID )
267262 if res , ok := gw .Messages .Get (msgID ); ok {
268263 IDs := res .([]* BrMsgID )
269- gw .logger .Debugf ("getDestMsgID: found %d cached destination IDs for msgID=%s" , len (IDs ), msgID )
270264 for _ , id := range IDs {
271- gw .logger .Debugf ("getDestMsgID: checking cached entry: br.Protocol=%s, br.Name=%s, ChannelID=%s, ID=%s" , id .br .Protocol , id .br .Name , id .ChannelID , id .ID )
272265 // check protocol, bridge name and channelname
273266 // for people that reuse the same bridge multiple times. see #342
274267 if dest .Protocol == id .br .Protocol && dest .Name == id .br .Name && channel .ID == id .ChannelID {
275- result := strings .Replace (id .ID , dest .Protocol + " " , "" , 1 )
276- gw .logger .Debugf ("getDestMsgID: match found, returning %s" , result )
277- return result
268+ return strings .Replace (id .ID , dest .Protocol + " " , "" , 1 )
278269 }
279270 }
280- gw .logger .Debugf ("getDestMsgID: no matching entry found in cached IDs" )
281- } else {
282- gw .logger .Debugf ("getDestMsgID: msgID=%s not found in cache" , msgID )
283271 }
284272 return ""
285273}
@@ -486,21 +474,16 @@ func (gw *Gateway) SendMessage(
486474 msg .Channel = rmsg .Channel
487475 }
488476
489- gw .logger .Debugf ("SendMessage: rmsg.ParentID=%s, canonicalParentMsgID=%s" , rmsg .ParentID , canonicalParentMsgID )
490477 msg .ParentID = gw .getDestMsgID (canonicalParentMsgID , dest , channel )
491- gw .logger .Debugf ("SendMessage: after getDestMsgID, msg.ParentID=%s" , msg .ParentID )
492478 if msg .ParentID == "" {
493479 msg .ParentID = strings .Replace (canonicalParentMsgID , dest .Protocol + " " , "" , 1 )
494- gw .logger .Debugf ("SendMessage: after fallback strip, msg.ParentID=%s" , msg .ParentID )
495480 }
496481
497482 // if the parentID is still empty and we have a parentID set in the original message
498483 // this means that we didn't find it in the cache so set it to a "msg-parent-not-found" constant
499484 if msg .ParentID == "" && rmsg .ParentID != "" {
500- gw .logger .Debugf ("SendMessage: parent not found in cache, setting to ParentIDNotFound" )
501485 msg .ParentID = config .ParentIDNotFound
502486 }
503- gw .logger .Debugf ("SendMessage: final msg.ParentID=%s" , msg .ParentID )
504487
505488 drop , err := gw .modifyOutMessageTengo (rmsg , & msg , dest )
506489 if err != nil {
0 commit comments