mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 11:56:29 +00:00
Re-vendor queue-worker publisher for reconnect
- re-vendor queue-worker for publisher via 0.6.0 - bump queue-worker version to 0.6.0 in docker-compose.yml for AMD64 - use new naming for NATS of nats -> NATS in variables where required - add default reconnect of 60 times, 2 seconds apart. Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
e63150ef70
commit
b4a550327d
8
gateway/vendor/github.com/openfaas/nats-queue-worker/nats/client.go
generated
vendored
Normal file
8
gateway/vendor/github.com/openfaas/nats-queue-worker/nats/client.go
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
package nats
|
||||
|
||||
import "regexp"
|
||||
|
||||
var supportedCharacters = regexp.MustCompile("[^a-zA-Z0-9-_]+")
|
||||
func GetClientID(value string) string {
|
||||
return supportedCharacters.ReplaceAllString(value, "_")
|
||||
}
|
23
gateway/vendor/github.com/openfaas/nats-queue-worker/nats/client_test.go
generated
vendored
Normal file
23
gateway/vendor/github.com/openfaas/nats-queue-worker/nats/client_test.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
package nats
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetClientID(t *testing.T) {
|
||||
clientID := GetClientID("computer-a")
|
||||
want := "computer-a"
|
||||
if clientID != want {
|
||||
t.Logf("Want clientID: `%s`, but got: `%s`\n", want, clientID)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetClientIDWhenHostHasUnsupportedCharacters(t *testing.T) {
|
||||
clientID := GetClientID("computer-a.acme.com")
|
||||
want := "computer-a_acme_com"
|
||||
if clientID != want {
|
||||
t.Logf("Want clientID: `%s`, but got: `%s`\n", want, clientID)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user