forked from yuxh/gearman-go
Add sync lock on do() to avoid race conditions when creating jobs
This commit is contained in:
parent
b79fee2965
commit
27942f55cd
@ -220,6 +220,8 @@ func (client *Client) do(funcname string, data []byte,
|
|||||||
if client.conn == nil {
|
if client.conn == nil {
|
||||||
return "", ErrLostConn
|
return "", ErrLostConn
|
||||||
}
|
}
|
||||||
|
client.Lock()
|
||||||
|
defer client.Unlock()
|
||||||
var result = make(chan handleOrError, 1)
|
var result = make(chan handleOrError, 1)
|
||||||
client.lastcall = "c"
|
client.lastcall = "c"
|
||||||
client.innerHandler.put("c", func(resp *Response) {
|
client.innerHandler.put("c", func(resp *Response) {
|
||||||
|
Loading…
Reference in New Issue
Block a user