forked from yuxh/gearman-go
		
	Fix job register with timeout set
Fixed issue where timeout is sent as binary encoded uint but server expects a string
This commit is contained in:
		
							parent
							
								
									d0e6ec4878
								
							
						
					
					
						commit
						f333ba6102
					
				@ -3,10 +3,10 @@
 | 
				
			|||||||
package worker
 | 
					package worker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/binary"
 | 
					 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
						"strconv"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@ -106,10 +106,12 @@ func prepFuncOutpack(funcname string, timeout uint32) *outPack {
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		outpack.dataType = dtCanDoTimeout
 | 
							outpack.dataType = dtCanDoTimeout
 | 
				
			||||||
		l := len(funcname)
 | 
							l := len(funcname)
 | 
				
			||||||
		outpack.data = getBuffer(l + 5)
 | 
					
 | 
				
			||||||
 | 
							timeoutString := strconv.FormatUint(uint64(timeout), 10)
 | 
				
			||||||
 | 
							outpack.data = getBuffer(l + len(timeoutString) + 1)
 | 
				
			||||||
		copy(outpack.data, []byte(funcname))
 | 
							copy(outpack.data, []byte(funcname))
 | 
				
			||||||
		outpack.data[l] = '\x00'
 | 
							outpack.data[l] = '\x00'
 | 
				
			||||||
		binary.BigEndian.PutUint32(outpack.data[l+1:], timeout)
 | 
							copy(outpack.data[l+1:], []byte(timeoutString))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return outpack
 | 
						return outpack
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user