clarify session expiration
@@ -35,7 +35,7 @@ import (
// sessionHandle is an interface for transactions to access Cloud Spanner sessions safely. It is generated by sessionPool.take().
type sessionHandle struct {
- // mu guarantees that inner session object is returned / destroyed only once.
+ // mu guarantees that the inner session object is returned / destroyed only once.
mu sync.Mutex
// session is a pointer to a session object. Transactions never need to access it directly.
session *session
@@ -298,7 +298,7 @@ func (s *session) getNextCheck() time.Time {
func (s *session) recycle() {
s.setTransactionID(nil)
if !s.pool.recycle(s) {
- // s is rejected by its home session pool because it expired and the session pool is currently having enough number of open sessions.
+ // s is rejected by its home session pool because it expired and the session pool currently has enough open sessions.
s.destroy(false)
}
}
@@ -343,8 +343,8 @@ func (s *session) prepareForWrite(ctx context.Context) error {
type SessionPoolConfig struct {
// getRPCClient is the caller supplied method for getting a gRPC client to Cloud Spanner, this makes session pool able to use client pooling.
getRPCClient func() (sppb.SpannerClient, error)
- // MaxOpened is the maximum number of opened sessions that is allowed by the
- // session pool. Default to NumChannels * 100.
+ // MaxOpened is the maximum number of opened sessions allowed by the
+ // session pool. Defaults to NumChannels * 100.
MaxOpened uint64
// MinOpened is the minimum number of opened sessions that the session pool
// tries to maintain. Session pool won't continue to expire sessions if number
@@ -678,7 +678,7 @@ func (p *sessionPool) recycle(s *session) bool {
return false
}
if p.maxSessionAge != 0 && s.createTime.Add(p.maxSessionAge).Before(time.Now()) && p.numOpened > p.MinOpened {
- // session expires and number of opened sessions exceeds MinOpened, let the session itself.
+ // session expires and number of opened sessions exceeds MinOpened, let the session destroy itself.
return false
}
// Put session at the back of the list to round robin for load balancing across channels.
