mirror of https://github.com/go-redis/redis.git
Fix build on 32bit arch
This commit is contained in:
parent
063393987a
commit
a64d3e1ef1
1
Makefile
1
Makefile
|
@ -1,6 +1,7 @@
|
|||
all: testdeps
|
||||
go test ./...
|
||||
go test ./... -short -race
|
||||
env GOOS=linux GOARCH=386 go test ./...
|
||||
go vet
|
||||
|
||||
testdeps: testdata/redis/src/redis-server
|
||||
|
|
10
cluster.go
10
cluster.go
|
@ -126,7 +126,7 @@ type clusterNode struct {
|
|||
|
||||
latency uint32 // atomic
|
||||
generation uint32 // atomic
|
||||
loading int64 // atomic
|
||||
loading uint32 // atomic
|
||||
}
|
||||
|
||||
func newClusterNode(clOpt *ClusterOptions, addr string) *clusterNode {
|
||||
|
@ -171,20 +171,20 @@ func (n *clusterNode) Latency() time.Duration {
|
|||
}
|
||||
|
||||
func (n *clusterNode) MarkAsLoading() {
|
||||
atomic.StoreInt64(&n.loading, time.Now().Unix())
|
||||
atomic.StoreUint32(&n.loading, uint32(time.Now().Unix()))
|
||||
}
|
||||
|
||||
func (n *clusterNode) Loading() bool {
|
||||
const minute = int64(time.Minute / time.Second)
|
||||
|
||||
loading := atomic.LoadInt64(&n.loading)
|
||||
loading := atomic.LoadUint32(&n.loading)
|
||||
if loading == 0 {
|
||||
return false
|
||||
}
|
||||
if time.Now().Unix()-loading < minute {
|
||||
if time.Now().Unix()-int64(loading) < minute {
|
||||
return true
|
||||
}
|
||||
atomic.StoreInt64(&n.loading, 0)
|
||||
atomic.StoreUint32(&n.loading, 0)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue