[ARVADOS] created: 3652f3ed82e994c9eea74ba1afb4aa3c11ebd697
Git user
git at public.curoverse.com
Mon May 8 15:04:33 EDT 2017
at 3652f3ed82e994c9eea74ba1afb4aa3c11ebd697 (commit)
commit 3652f3ed82e994c9eea74ba1afb4aa3c11ebd697
Author: Tom Clegg <tom at curoverse.com>
Date: Mon May 8 15:02:54 2017 -0400
11638: Add PostgresPool config option, and default application_name
diff --git a/services/ws/config.go b/services/ws/config.go
index 0faa863..79c2f23 100644
--- a/services/ws/config.go
+++ b/services/ws/config.go
@@ -7,11 +7,12 @@ import (
)
type wsConfig struct {
- Client arvados.Client
- Postgres pgConfig
- Listen string
- LogLevel string
- LogFormat string
+ Client arvados.Client
+ Postgres pgConfig
+ PostgresPool int
+ Listen string
+ LogLevel string
+ LogFormat string
PingTimeout arvados.Duration
ClientEventQueue int
@@ -24,13 +25,15 @@ func defaultConfig() wsConfig {
APIHost: "localhost:443",
},
Postgres: pgConfig{
- "dbname": "arvados_production",
- "user": "arvados",
- "password": "xyzzy",
- "host": "localhost",
- "connect_timeout": "30",
- "sslmode": "require",
+ "dbname": "arvados_production",
+ "user": "arvados",
+ "password": "xyzzy",
+ "host": "localhost",
+ "connect_timeout": "30",
+ "sslmode": "require",
+ "fallback_application_name": "arvados-ws",
},
+ PostgresPool: 64,
LogLevel: "info",
LogFormat: "json",
PingTimeout: arvados.Duration(time.Minute),
diff --git a/services/ws/event_source.go b/services/ws/event_source.go
index fe1876c..1cc5ae7 100644
--- a/services/ws/event_source.go
+++ b/services/ws/event_source.go
@@ -29,8 +29,9 @@ func (c pgConfig) ConnectionString() string {
}
type pgEventSource struct {
- DataSource string
- QueueSize int
+ DataSource string
+ MaxOpenConns int
+ QueueSize int
db *sql.DB
pqListener *pq.Listener
@@ -115,6 +116,7 @@ func (ps *pgEventSource) Run() {
logger(nil).WithError(err).Error("sql.Open failed")
return
}
+ db.SetMaxOpenConns(ps.MaxOpenConns)
if err = db.Ping(); err != nil {
logger(nil).WithError(err).Error("db.Ping failed")
return
diff --git a/services/ws/server.go b/services/ws/server.go
index 8870ca1..059b073 100644
--- a/services/ws/server.go
+++ b/services/ws/server.go
@@ -44,8 +44,9 @@ func (srv *server) setup() {
srv.listener = ln
srv.eventSource = &pgEventSource{
- DataSource: srv.wsConfig.Postgres.ConnectionString(),
- QueueSize: srv.wsConfig.ServerEventQueue,
+ DataSource: srv.wsConfig.Postgres.ConnectionString(),
+ MaxOpenConns: srv.wsConfig.PostgresPool,
+ QueueSize: srv.wsConfig.ServerEventQueue,
}
srv.httpServer = &http.Server{
Addr: srv.wsConfig.Listen,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list