diff options
-rw-r--r-- | chat/buddy.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chat/buddy.go b/chat/buddy.go index 5b2308c..d369c61 100644 --- a/chat/buddy.go +++ b/chat/buddy.go @@ -28,9 +28,11 @@ func (b *Buddy) Leave() { // Push pushes a message to the buddies Receive channel func (b *Buddy) Push(msg Message) { go func() { + t := time.NewTicker(time.Millisecond * 100) + defer t.Stop() select { case b.Receive <- msg: - case <-time.Tick(time.Millisecond * 100): + case <-t.C: } }() } |