Merge pull request #9 from nightlyone/do-bg-no-id

do not generate unique id on background job submission
This commit is contained in:
Xing 2013-02-19 06:16:03 -08:00
commit faa0ca07ee

View File

@ -283,8 +283,7 @@ func (client *Client) writeJob(job *Job) {
// Internal do // Internal do
func (client *Client) do(funcname string, data []byte, func (client *Client) do(funcname string, data []byte,
flag uint32) (id string, handle string) { flag uint32, id string) (handle string) {
id = strconv.Itoa(int(ai.Id()))
l := len(funcname) + len(id) + len(data) + 2 l := len(funcname) + len(id) + len(data) + 2
rel := make([]byte, 0, l) rel := make([]byte, 0, l)
rel = append(rel, []byte(funcname)...) // len(funcname) rel = append(rel, []byte(funcname)...) // len(funcname)
@ -317,8 +316,8 @@ flag byte, jobhandler JobHandler) (handle string) {
default: default:
datatype = common.SUBMIT_JOB datatype = common.SUBMIT_JOB
} }
var id string id := strconv.Itoa(int(ai.Id()))
id, handle = client.do(funcname, data, datatype) handle = client.do(funcname, data, datatype, id)
if jobhandler != nil { if jobhandler != nil {
client.jobhandlers[id] = jobhandler client.jobhandlers[id] = jobhandler
} }
@ -336,7 +335,7 @@ flag byte) (handle string) {
default: default:
datatype = common.SUBMIT_JOB_BG datatype = common.SUBMIT_JOB_BG
} }
_, handle = client.do(funcname, data, datatype) handle = client.do(funcname, data, datatype, "")
return return
} }