Skip to content

Commit

Permalink
update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Hahn committed Nov 11, 2019
1 parent fa0e88b commit 2f0ad6a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 1 addition & 3 deletions cluster/nats_rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ func (ns *NatsRPCClient) configure() error {
if ns.connString == "" {
return constants.ErrNoNatsConnectionString
}
if timeout := ns.config.GetDuration("pitaya.cluster.rpc.client.nats.connectiontimeout"); timeout != 0 {
ns.connectionTimeout = timeout
}
ns.connectionTimeout = ns.config.GetDuration("pitaya.cluster.rpc.client.nats.connectiontimeout")
ns.maxReconnectionRetries = ns.config.GetInt("pitaya.cluster.rpc.client.nats.maxreconnectionretries")
ns.reqTimeout = ns.config.GetDuration("pitaya.cluster.rpc.client.nats.requesttimeout")
if ns.reqTimeout == 0 {
Expand Down
4 changes: 1 addition & 3 deletions cluster/nats_rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ func (ns *NatsRPCServer) configure() error {
if ns.connString == "" {
return constants.ErrNoNatsConnectionString
}
if timeout := ns.config.GetDuration("pitaya.cluster.rpc.server.nats.connectiontimeout"); timeout != 0 {
ns.connectionTimeout = timeout
}
ns.connectionTimeout = ns.config.GetDuration("pitaya.cluster.rpc.server.nats.connectiontimeout")
ns.maxReconnectionRetries = ns.config.GetInt("pitaya.cluster.rpc.server.nats.maxreconnectionretries")
ns.messagesBufferSize = ns.config.GetInt("pitaya.buffer.cluster.rpc.server.nats.messages")
if ns.messagesBufferSize == 0 {
Expand Down
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ func (c *Config) fillDefaultValues() {
"pitaya.cluster.rpc.client.grpc.requesttimeout": "5s",
"pitaya.cluster.rpc.client.grpc.lazyconnection": false,
"pitaya.cluster.rpc.client.nats.connect": "nats://localhost:4222",
"pitaya.cluster.rpc.client.nats.connectiontimeout": "2s",
"pitaya.cluster.rpc.client.nats.maxreconnectionretries": 15,
"pitaya.cluster.rpc.client.nats.requesttimeout": "5s",
"pitaya.cluster.rpc.server.grpc.externalport": 3434,
"pitaya.cluster.rpc.server.grpc.port": 3434,
"pitaya.cluster.rpc.server.nats.connect": "nats://localhost:4222",
"pitaya.cluster.rpc.server.nats.connectiontimeout": "2s",
"pitaya.cluster.rpc.server.nats.maxreconnectionretries": 15,
"pitaya.cluster.sd.etcd.dialtimeout": "5s",
"pitaya.cluster.sd.etcd.endpoints": "localhost:2379",
Expand All @@ -78,6 +80,8 @@ func (c *Config) fillDefaultValues() {
"pitaya.cluster.sd.etcd.revoke.timeout": "5s",
"pitaya.cluster.sd.etcd.syncservers.interval": "120s",
"pitaya.cluster.sd.etcd.shutdown.delay": "10ms",
"pitaya.cluster.sd.etcd.servertypeblacklist": nil,
"pitaya.cluster.sd.etcd.syncserversparallelism": 10,
// the sum of this config among all the frontend servers should always be less than
// the sum of pitaya.buffer.cluster.rpc.server.nats.messages, for covering the worst case scenario
// a single backend server should have the config pitaya.buffer.cluster.rpc.server.nats.messages bigger
Expand Down
16 changes: 16 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ These configuration values configure service discovery for the default etcd serv
- 10ms
- time.Duration
- Time to wait to shutdown after deregistering from service discovery
* - pitaya.cluster.sd.etcd.servertypeblacklist
- nil
- []string
- A list of server types that should be ignored by the service discovery
* - pitaya.cluster.sd.etcd.syncserversparallelism
- 10
- int
- The number of goroutines that should be used while getting server information on etcd initialization

RPC Service
===========
Expand Down Expand Up @@ -110,6 +118,10 @@ The configurations only need to be set if the RPC Service is enabled with the gi
- nats://localhost:4222
- string
- Nats address for the client
* - pitaya.cluster.rpc.client.nats.connectiontimeout
- 5s
- time.Duration
- Timeout for the nats client to establish the connection
* - pitaya.cluster.rpc.client.nats.requesttimeout
- 5s
- time.Time
Expand All @@ -122,6 +134,10 @@ The configurations only need to be set if the RPC Service is enabled with the gi
- nats://localhost:4222
- string
- Nats address for the server
* - pitaya.cluster.rpc.server.nats.connectiontimeout
- 5s
- time.Duration
- Timeout for the nats server to establish the connection
* - pitaya.cluster.rpc.server.nats.maxreconnectionretries
- 15
- int
Expand Down

0 comments on commit 2f0ad6a

Please sign in to comment.