@@ -99,21 +99,27 @@ func (t *WorkerService) workerListV1(ctx echo.Context, tenant *sqlcv1.Tenant, re
9999 telemetry.AttributeKV {Key : "tenant.id" , Value : tenant .ID },
100100 )
101101
102- workers , err := t .config .V1 .Workers ().ListWorkers (listCtx , tenantId , opts )
102+ workerRows , err := t .config .V1 .Workers ().ListWorkers (listCtx , tenantId , opts )
103103
104104 if err != nil {
105105 listSpan .RecordError (err )
106106 return nil , err
107107 }
108108
109+ workers := make ([]sqlcv1.Worker , len (workerRows ))
110+
111+ for i , workerRow := range workerRows {
112+ workers [i ] = workerRow .Worker
113+ }
114+
109115 telemetry .WithAttributes (listSpan ,
110116 telemetry.AttributeKV {Key : "workers.count" , Value : len (workers )},
111117 )
112118
113119 workerIdSet := make (map [uuid.UUID ]struct {})
114120
115121 for _ , worker := range workers {
116- workerIdSet [worker .Worker . ID ] = struct {}{}
122+ workerIdSet [worker .ID ] = struct {}{}
117123 }
118124
119125 workerIds := make ([]uuid.UUID , 0 , len (workerIdSet ))
@@ -128,10 +134,10 @@ func (t *WorkerService) workerListV1(ctx echo.Context, tenant *sqlcv1.Tenant, re
128134 telemetry.AttributeKV {Key : "workers.unique_ids.count" , Value : len (workerIds )},
129135 )
130136
131- workerIdToActionIds , err := t .config .V1 .Workers ().GetWorkerActionsByWorkerId (
137+ workerIdToActionIds , err := t .config .V1 .Workers ().GetWorkerActionsForWorkers (
132138 listCtx ,
133139 tenant .ID ,
134- workerIds ,
140+ workers ,
135141 )
136142
137143 if err != nil {
@@ -160,11 +166,11 @@ func (t *WorkerService) workerListV1(ctx echo.Context, tenant *sqlcv1.Tenant, re
160166
161167 for i , worker := range workers {
162168 workerCp := worker
163- actions := workerIdToActionIds [workerCp .Worker . ID .String ()]
164- slotConfig := workerSlotConfig [workerCp .Worker . ID ]
165- labels := workerIdToLabels [workerCp .Worker . ID ]
169+ actions := workerIdToActionIds [workerCp .ID .String ()]
170+ slotConfig := workerSlotConfig [workerCp .ID ]
171+ labels := workerIdToLabels [workerCp .ID ]
166172
167- rows [i ] = * transformersv1 .ToWorkerSqlc (& workerCp . Worker , slotConfig , actions , nil , labels )
173+ rows [i ] = * transformersv1 .ToWorkerSqlc (& workerCp , slotConfig , actions , nil , labels )
168174 }
169175
170176 return gen .WorkerList200JSONResponse (
0 commit comments