From fd1bde7936d228557fc5c252e6dd61627e18e7b9 Mon Sep 17 00:00:00 2001 From: Fernando Takagi Date: Mon, 23 Oct 2023 15:47:24 -0300 Subject: [PATCH] Update pipeline_status.go --- server/pipeline_status.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/pipeline_status.go b/server/pipeline_status.go index 4ade9db048..74110c74a9 100644 --- a/server/pipeline_status.go +++ b/server/pipeline_status.go @@ -124,11 +124,9 @@ func (p *Pipeline) statusFollow(logger *zap.Logger, session Session, envelope *r for userID := range uniqueUserIDs { ids = append(ids, userID) } - counter := 1 if len(ids) != 0 { - query += fmt.Sprintf("id = ANY($%d::UUID[])", counter) params = append(params, ids) - counter++ + query += fmt.Sprintf("id = ANY($%d::UUID[])", len(params)) } usernames := make([]string, 0, len(uniqueUsernames)) @@ -138,8 +136,8 @@ func (p *Pipeline) statusFollow(logger *zap.Logger, session Session, envelope *r if len(uniqueUserIDs) != 0 { query += " OR " } - query += fmt.Sprintf("username = ANY($%d::text[])", counter) params = append(params, usernames) + query += fmt.Sprintf("username = ANY($%d::text[])", len(params)) // See if all the users exist. rows, err := p.db.QueryContext(session.Context(), query, params...)