Try explicit ticker allocation instead of Tick

This commit is contained in:
Jason Coene
2013-07-07 11:39:18 -05:00
parent cc0e886ec7
commit 301e0d67e4
+5 -2
View File
@@ -184,12 +184,15 @@ func (c *Client) Call(msg *Message, t uint32) (response *Response, err error) {
c.SendMessage(msg)
tid := msg.TransactionId
poll := time.Tick(time.Duration(5) * time.Millisecond)
ticker := time.NewTicker(time.Duration(5) * time.Millisecond)
defer ticker.Stop()
timeout := time.After(time.Duration(t) * time.Second)
for {
select {
case <-poll:
case <-ticker.C:
res, ready := c.GetResponse(tid)
if ready {
return res, nil