Skip to content

Commit

Permalink
do not merge: prime task manager cache
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam committed Jul 3, 2024
1 parent 2ba93e2 commit a961df2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func main() {
Client: client,
DB: db,
}
err = taskManager.Prime()
if err != nil {
return
}
taskManager.Run(context.Background())
//
// Reaper
Expand Down
7 changes: 7 additions & 0 deletions task/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ type Manager struct {
queue chan func()
}

// Prime the CR cache.
func (m *Manager) Prime() (err error) {
m.cluster.Client = m.Client
err = m.cluster.Refresh()
return
}

// Run the manager.
func (m *Manager) Run(ctx context.Context) {
m.queue = make(chan func(), 100)
Expand Down

0 comments on commit a961df2

Please sign in to comment.