Closed mary-dcouto closed 3 years ago
I don't see what this is going to solve or why. the select should be performant enough. are you able to reproduce this bug now locally? if so I'd really like to understand what happens here, I'm not quite seeing it
I added a log after "case <- time.After(time.Minute):" and tested it locally. this was not getting printed every minute. It was getting printed randomly like 1 minute, 3 minutes, 5 minutes, 20 minutes etc, so I found that there is a delay, in the select case statements, when you have data in more than one channels in the case statements
could you share where you put that log message? if it's random like that i'm thinking you had it inside the for loop and when it didn't fire it was because there were no requests to process?
I think the real issue is that this event should probably fire every second or every five seconds and not every minute. if it fires every minute a request that comes in "one second" after it just fired would sit there for 59 seconds - be valid and then only be reclaimed after another minute (1m 59s)
what happens if you put that log outside the loop and set this timer to 1 second or 5 seconds without the goroutine cleanups?
I added the log statement before for loop in the case statement for timeout and it is not consistently displayed every minute.
close #387