airbrake / gobrake

Airbrake notifier for Golang
https://docs.airbrake.io/docs/platforms/go-lang
MIT License
104 stars 42 forks source link

setNoticeBacklog meant to never terminate? #378

Open bchemel opened 1 year ago

bchemel commented 1 year ago

Hello! I'm chasing down a problem in some remotely-deployed embedded engine code that uses gobrake to upload errors to airbrake. I'm not sure that it's related to our problem, but I just started a dive into the backlog capabilities added in v5.6.0 and the following code caught my eye - is this for loop intended to loop forever? I would (naively) expect it to wait for the backlog period, flush, and then exit.

Thank you! Brian

// setNoticeBacklog sets new backlog notice.
func setNoticeBacklog(notice *Notice) {
    if nb.opt.DisableBacklog {
        return
    }
    if len(nb.notices) < nb.maxLength {
        nb.notices = append(nb.notices, *notice)
    }
    for {
        <-time.After(flushBacklogPeriod)
        nb.flushNoticeBacklog()
    }
}