minus5 / go-uof-sdk

Betradar Unified Odds Feed SDK for the Go programming language.
MIT License
18 stars 17 forks source link

bugfix: resolve negative waitgroup counter panic on SDK exit #8

Closed MSalopek closed 4 years ago

MSalopek commented 4 years ago

Bug was caused by calling WaitGroup.Done() inside an infinite loop.

The issue would not occur if the recovery was successful, but would in case the Betradar Producer was down or not available for some reasons.

Each time the recovery would fail, there would be an additional defer WG.Done() call, but with only one WG.Add(1) call just before spawning the recovery goroutine.

With this patch SDK no longer panics on exit.

Associated BaseCamp task: https://3.basecamp.com/3077084/buckets/13717705/todos/2476389286