You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
now that we have a channel instead of a queue, we can now define a custom time based (and maybe event time + number of already active transient sessions) "session scaling" policy that allows to return a transient session after waiting for a while for sessions to be returned before trying to create a new transient connection + session.
The text was updated successfully, but these errors were encountered:
select {
// sp = session poolcase<-sp.ctx.Done():
returnnil, ErrClosedcase<-ctx.Done():
returnnil, ctx.Err()
cases, ok<- sp.sessions:
if!ok{
returnnil, ErrClosed
}
returns, nildefault:
timeout, scale:=sp.AutoScalePolicy(s.ActiveTransientConnections, s.ActiveTransientSessions)
varwaitChanchantime.Time=nil// blocking foreverifscale {
waitChan=time.After(timeout) // we might need to use an actual time.Timer here that can be properly closed when it is not needed anymore
}
select {
case<-sp.ctx.Done():
returnnil, ErrClosedcase<-ctx.Done():
returnnil, ctx.Err()
cases, ok<-sp.sessions:
if!ok {
returnnil, ErrClosed
}
returns, nilcase<-waitChan:
returnsp.GetTransientSession(ctx) // might need to use an unguarded variant of the method here
}
}
}
now that we have a channel instead of a queue, we can now define a custom time based (and maybe event time + number of already active transient sessions) "session scaling" policy that allows to return a transient session after waiting for a while for sessions to be returned before trying to create a new transient connection + session.
The text was updated successfully, but these errors were encountered: