Skip to content

Instantly share code, notes, and snippets.

@Happytreat
Created January 1, 2021 08:46
Show Gist options
  • Save Happytreat/2693d6d3f1f764f974e54ece5c49f05f to your computer and use it in GitHub Desktop.
Save Happytreat/2693d6d3f1f764f974e54ece5c49f05f to your computer and use it in GitHub Desktop.
Connection Pool Options
type ConnectionOptions struct {
// The initial num of active connections when pool is initialised
// Pros: Warmup the connection pool with some connections on startup.
InitialActiveConnections int
// The maximum number of connections that can be active at any given
// time
MaxActiveConnections int
// The maximum number of idle connections per host that are kept alive by
// the connection pool.
MaxIdleConnections uint
// The maximum amount of time an idle connection can stay alive. If not
// specified, connection stays active until pool closes or discarded.
MaxIdleTime *time.Duration
// This specifies the timeout for any Read() operation.
// Note that setting this to 0 (i.e. not setting it) will make
// read operations block indefinitely.
ReadTimeout time.Duration
// This specifies the timeout for any Write() operation.
// Note that setting this to 0 (i.e. not setting it) will make
// write operations block indefinitely.
WriteTimeout time.Duration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment