File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,6 +138,24 @@ func (s *SumoLogicAppender) SendToSumo(logStringToSend string) {
138138 if err != nil {
139139 logging .Error .Printf ("http.Do() error: %v\n " , err )
140140 return
141+ } else if response .StatusCode == 429 { //that the endpoint needs some time and dropped the post sent
142+ logging .Trace .Println ("Endpoint dropped the post send" )
143+ logging .Trace .Println ("Waiting for 300 ms to retry" )
144+ time .Sleep (300 * time .Millisecond )
145+ responseRetry , errRetry := s .httpClient .Do (request )
146+ for responseRetry .StatusCode == 429 {
147+ logging .Trace .Println ("Waiting for 300 ms to retry" )
148+ time .Sleep (300 * time .Millisecond )
149+ responseRetry , errRetry = s .httpClient .Do (request )
150+ }
151+ if errRetry != nil {
152+ logging .Error .Printf ("http.Do() error: %v\n " , err )
153+ return
154+ } else {
155+ logging .Trace .Println ("Post of logs successful" )
156+ s .timerBetweenPost = time .Now ()
157+ }
158+
141159 } else {
142160 logging .Trace .Println ("Post of logs successful" )
143161 s .timerBetweenPost = time .Now ()
You can’t perform that action at this time.
0 commit comments