Retry failed sends with their send_id until the server confirms them
This commit is contained in:
@@ -1356,6 +1356,16 @@ func (s *Store) SessionStarted(ctx context.Context, sessionID string) (bool, err
|
||||
return started, err
|
||||
}
|
||||
|
||||
func (s *Store) UnusedSession(ctx context.Context, taskID, member string) (string, bool, error) {
|
||||
id := ""
|
||||
err := s.db.QueryRowContext(ctx, `SELECT id FROM agent_sessions WHERE task_id = ? AND member = ? AND role = ? AND state = ? AND started = 0 AND pending = 0 LIMIT 1`,
|
||||
taskID, member, string(api.Implementer), string(api.AgentSessionStateIdle)).Scan(&id)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return "", false, nil
|
||||
}
|
||||
return id, err == nil, err
|
||||
}
|
||||
|
||||
func (s *Store) SessionPending(ctx context.Context, sessionID string) (bool, error) {
|
||||
pending := false
|
||||
err := s.db.QueryRowContext(ctx, `SELECT pending FROM agent_sessions WHERE id = ?`, sessionID).Scan(&pending)
|
||||
|
||||
Reference in New Issue
Block a user