session: remove variadic State param from ListSessionsByState

We only really ever use it in one place and even then, only for a
session State that we no longer use anymore.

This is done to make the SQL queries we will need to implement the SQL
Store more simple.
This commit is contained in:
Elle Mouton 2025-03-02 08:22:59 +02:00
parent 66b0f15176
commit 306519fd6d
No known key found for this signature in database
GPG key ID: D7D916376026F177
4 changed files with 17 additions and 24 deletions

View file

@ -102,13 +102,23 @@ func (s *sessionRpcServer) start(ctx context.Context) error {
}
// Start up all previously created sessions.
sessions, err := s.cfg.db.ListSessionsByState(
ctx, session.StateCreated, session.StateInUse,
sessions, err := s.cfg.db.ListSessionsByState(ctx, session.StateCreated)
if err != nil {
return fmt.Errorf("error listing sessions: %v", err)
}
// For backwards compatibility, we will also resume sessions that are in
// the InUse state even though we no longer put sessions into this
// state.
inUseSessions, err := s.cfg.db.ListSessionsByState(
ctx, session.StateInUse,
)
if err != nil {
return fmt.Errorf("error listing sessions: %v", err)
}
sessions = append(sessions, inUseSessions...)
for _, sess := range sessions {
key := sess.LocalPublicKey.SerializeCompressed()