address op state review feedback (#2453)

* address op state review feedback
This commit is contained in:
Irena Rindos authored and GitHub committed 2022-09-16 09:13:37 -04:00
1 parent c73a13aa3e
commit 821d8317dc
6 files changed
+122 -55

No files matched your search

+4 -4
View File
@@ -164,7 +164,7 @@ func lookupWorker(ctx context.Context, reader db.Reader, id string) (*Worker, er
// then the last status update time is ignored.
// If WithLimit < 0, then unlimited results are returned. If WithLimit == 0, then
// default limits are used for results.
// Also supports: WithWorkerType, WithExcludeShutdownWorkers
// Also supports: WithWorkerType, WithActiveWorkers
func (r *Repository) ListWorkers(ctx context.Context, scopeIds []string, opt ...Option) ([]*Worker, error) {
const op = "server.(Repository).ListWorkers"
switch {
@@ -197,9 +197,9 @@ func (r *Repository) ListWorkers(ctx context.Context, scopeIds []string, opt ...
return nil, errors.New(ctx, errors.InvalidParameter, op, fmt.Sprintf("unknown worker type %v", opts.withWorkerType))
}
if opts.withExcludeShutdownWorkers {
where = append(where, "operational_state not in (?)")
whereArgs = append(whereArgs, ShutdownOperationalState.String())
if opts.withActiveWorkers {
where = append(where, "operational_state = ?")
whereArgs = append(whereArgs, ActiveOperationalState.String())
}
limit := r.defaultLimit