Skip to content

Commit

Permalink
Fix job register with timeout set
Browse files Browse the repository at this point in the history
Fixed issue where timeout is sent as binary encoded uint but server
expects a string
  • Loading branch information
Christoffer Fjellström committed Feb 13, 2019
1 parent d0e6ec4 commit f333ba6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
package worker

import (
"encoding/binary"
"fmt"
"sync"
"time"
"strconv"
)

const (
Expand Down Expand Up @@ -106,10 +106,12 @@ func prepFuncOutpack(funcname string, timeout uint32) *outPack {
} else {
outpack.dataType = dtCanDoTimeout
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))
outpack.data[l] = '\x00'
binary.BigEndian.PutUint32(outpack.data[l+1:], timeout)
copy(outpack.data[l+1:], []byte(timeoutString))
}
return outpack
}
Expand Down

0 comments on commit f333ba6

Please sign in to comment.