mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-10 12:10:23 +01:00
Support unix domain sockets in redis clients, too.
This commit is contained in:
parent
ba2dd15280
commit
e68e762322
|
@ -8,6 +8,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
)
|
||||
|
@ -71,7 +72,12 @@ func main() {
|
|||
|
||||
if !skipBaseLevel {
|
||||
td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0)
|
||||
address := fmt.Sprintf("%s:%d", host, port)
|
||||
var address string
|
||||
if strings.ContainsRune(host, '/') {
|
||||
address = host
|
||||
} else {
|
||||
address = fmt.Sprintf("%s:%d", host, port)
|
||||
}
|
||||
if err := createBaseLevel(
|
||||
address,
|
||||
xMin, yMin, zMin, xMax, yMax, zMax,
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
)
|
||||
|
@ -84,11 +85,16 @@ func main() {
|
|||
colors.TransparentDim = common.Clamp32f(
|
||||
float32(transparentDim/100.0), 0.0, 100.0)
|
||||
|
||||
address := fmt.Sprintf("%s:%d", host, port)
|
||||
var proto, address string
|
||||
if strings.ContainsRune(host, '/') {
|
||||
proto, address = "unix", host
|
||||
} else {
|
||||
proto, address = "tcp", fmt.Sprintf("%s:%d", host, port)
|
||||
}
|
||||
|
||||
var client *common.RedisClient
|
||||
|
||||
if client, err = common.NewRedisClient("tcp", address); err != nil {
|
||||
if client, err = common.NewRedisClient(proto, address); err != nil {
|
||||
log.Fatalf("Cannot connect to '%s': %s", address, err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
|
||||
|
@ -113,7 +114,12 @@ func main() {
|
|||
}
|
||||
colors.TransparentDim = common.Clamp32f(
|
||||
float32(transparentDim/100.0), 0.0, 100.0)
|
||||
redisAddress := fmt.Sprintf("%s:%d", redisHost, redisPort)
|
||||
var redisAddress string
|
||||
if strings.ContainsRune(redisHost, '/') {
|
||||
redisAddress = redisHost
|
||||
} else {
|
||||
redisAddress = fmt.Sprintf("%s:%d", redisHost, redisPort)
|
||||
}
|
||||
|
||||
var allowedUpdateIps []net.IP
|
||||
if allowedUpdateIps, err = ipsFromHosts(updateHosts); err != nil {
|
||||
|
|
|
@ -196,10 +196,17 @@ func (tu *tileUpdater) doUpdates() {
|
|||
jobs := make(chan *xzc)
|
||||
var done sync.WaitGroup
|
||||
|
||||
var proto string
|
||||
if strings.ContainsRune(tu.redisAddress, '/') {
|
||||
proto = "unix"
|
||||
} else {
|
||||
proto = "tcp"
|
||||
}
|
||||
|
||||
for i, n := 0, common.Min(tu.workers, len(changes)); i < n; i++ {
|
||||
var client *common.RedisClient
|
||||
var err error
|
||||
if client, err = common.NewRedisClient("tcp", tu.redisAddress); err != nil {
|
||||
if client, err = common.NewRedisClient(proto, tu.redisAddress); err != nil {
|
||||
log.Printf("WARN: Cannot connect to redis server: %s\n", err)
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user