Created
October 28, 2016 02:02
-
-
Save kaneshin/1a1402b2fcdf4936285e69d2787f5edf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ( | |
canPostSomeoneTypingMessage = func() func() bool { | |
enable := true | |
return func() bool { | |
if !enable { | |
return false | |
} | |
go func() { | |
select { | |
case <-time.After(10 * time.Minute): | |
enable = true | |
} | |
}() | |
defer func() { enable = false }() | |
return enable | |
} | |
}() | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment