Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/group/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ type MySQLBackend struct {
}

const maxConnections = 3
const electionExpireSeconds = 5
const electionExpireSeconds = 10

const electionInterval = time.Second
const electionInterval = 2 * time.Second
const healthInterval = 2 * electionInterval
const stateInterval = 10 * time.Second

Expand Down Expand Up @@ -113,7 +113,7 @@ func getBackendDBUri() string {
// Set collation instead of charset, if BackendMySQLCollation is specified
dsnCharsetCollation = fmt.Sprintf("collation=%s", config.Settings().BackendMySQLCollation)
}
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?interpolateParams=true&%s&timeout=500ms",
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?interpolateParams=true&%s&timeout=8s",
config.Settings().BackendMySQLUser,
config.Settings().BackendMySQLPassword,
config.Settings().BackendMySQLHost,
Expand Down
4 changes: 2 additions & 2 deletions pkg/group/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func TestGetBackendDBUri(t *testing.T) {

// test default (charset)
dbUri := getBackendDBUri()
test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&charset=utf8mb4,utf8,latin1&timeout=500ms")
test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&charset=utf8mb4,utf8,latin1&timeout=8s")

// test setting collation
config.Settings().BackendMySQLCollation = "utf8mb4_unicode_ci"
dbUri = getBackendDBUri()
test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&collation=utf8mb4_unicode_ci&timeout=500ms")
test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&collation=utf8mb4_unicode_ci&timeout=8s")
}
Loading