Skip to content

Commit

Permalink
Have shaqodoon ignore invalid certs, dont create status if sender alr…
Browse files Browse the repository at this point in the history
…eady did
  • Loading branch information
nicpottier committed Aug 23, 2017
1 parent 6dcc9b9 commit 0a668db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion handlers/shaqodoon/shaqodoon.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (h *handler) SendMsg(msg courier.Msg) (courier.MsgStatus, error) {

req, err := http.NewRequest(http.MethodGet, sendURL, nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
rr, err := utils.MakeHTTPRequest(req)
rr, err := utils.MakeInsecureHTTPRequest(req)

status := h.Backend().NewMsgStatusForID(msg.Channel(), msg.ID(), courier.MsgErrored)
status.AddLog(courier.NewChannelLogFromRR(msg.Channel(), msg.ID(), rr))
Expand Down
4 changes: 2 additions & 2 deletions responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func WriteError(w http.ResponseWriter, r *http.Request, err error) error {

// WriteIgnored writes a JSON response for the passed in message
func WriteIgnored(w http.ResponseWriter, r *http.Request, message string) error {
lg.Log(r.Context()).Info("ignored message")
lg.Log(r.Context()).Info("msg ignored")
return writeData(w, http.StatusOK, message, struct{}{})
}

Expand All @@ -43,7 +43,7 @@ func WriteReceiveSuccess(w http.ResponseWriter, r *http.Request, msg Msg) error
"msg_urn": msg.URN().Identity(),
"msg_text": msg.Text(),
"msg_attachments": msg.Attachments(),
}).Info("message received")
}).Info("msg received")
return writeData(w, http.StatusOK, "Message Accepted", &receiveData{msg.UUID()})
}

Expand Down
7 changes: 5 additions & 2 deletions sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (w *Sender) Send() {
w.foreman.server.WaitGroup().Add(1)
defer w.foreman.server.WaitGroup().Done()

log := logrus.WithField("comp", "sender").WithField("senderID", w.id)
log := logrus.WithField("comp", "sender").WithField("sender_id", w.id)
log.Debug("started")

server := w.foreman.server
Expand Down Expand Up @@ -174,7 +174,10 @@ func (w *Sender) Send() {
secondDuration := float64(duration) / float64(time.Second)

if err != nil {
status = backend.NewMsgStatusForID(msg.Channel(), msg.ID(), MsgErrored)
// sender didn't give us a status, build one ourselves
if status == nil {
status = backend.NewMsgStatusForID(msg.Channel(), msg.ID(), MsgErrored)
}
msgLog.WithError(err).WithField("elapsed", duration).Error("msg errored")
librato.Default.AddGauge(fmt.Sprintf("courier.msg_send_error_%s", msg.Channel().ChannelType()), secondDuration)
} else {
Expand Down

0 comments on commit 0a668db

Please sign in to comment.