Skip to content

Commit

Permalink
REF: using tslice for sort
Browse files Browse the repository at this point in the history
  • Loading branch information
poteto0 committed Feb 11, 2025
1 parent 8aa1325 commit 7694d2d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions poteto_workflow.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package poteto

import (
"sort"

"github.com/poteto-go/poteto/constant"
"github.com/poteto-go/tslice"
)

type UnitWorkflow struct {
Expand Down Expand Up @@ -53,8 +52,8 @@ func (pw *potetoWorkflows) ApplyStartUpWorkflows() error {
}

func sortWorkflows(workflows []UnitWorkflow) []UnitWorkflow {
sort.SliceStable(workflows, func(i, j int) bool {
return workflows[i].priority < workflows[j].priority
tslice.Sort(workflows, func(l, r UnitWorkflow) int {
return int(l.priority) - int(r.priority)
})
return workflows
}

0 comments on commit 7694d2d

Please sign in to comment.