Skip to content

Commit

Permalink
fix: goroutine leak in lambda report (#512)
Browse files Browse the repository at this point in the history
time.Tick leaks its goroutine since
it's not manageable. Instead, new ticker is
created and deferred to stop as soon as
function returns
  • Loading branch information
ferhatelmas authored and tj committed Dec 25, 2017
1 parent c4e604d commit 15c99d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion platform/lambda/stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ func (s *Stack) report(states map[string]Status) error {
"complete": 0,
})()

for range time.Tick(time.Second) {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()

for range ticker.C {
stack, err := s.getStack()

if util.IsNotFound(err) {
Expand Down

0 comments on commit 15c99d2

Please sign in to comment.