Skip to content

Commit

Permalink
add ticker for copilot syncing cluster and pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
shaowenchen committed Aug 21, 2024
1 parent 27427f4 commit 6f51ef9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
8 changes: 0 additions & 8 deletions pkg/copilot/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ import (

var GlobalCopilotOption *option.CopilotOption

type ChatCodeResponse Langcode

type Langcode struct {
Language string `json:"language"`
Code string `json:"code"`
Content string `json:"content"`
}

type RoleContent struct {
Role string `json:"role"`
Content string `json:"content"`
Expand Down
18 changes: 15 additions & 3 deletions pkg/copilot/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,25 @@ func NewPipelineRunsManager(endpoint, token, namespace string) (prManager *Pipel
func (m *PipelineRunsManager) Init() (err error) {
m.pipelines, err = m.GetPipelines()
if err != nil {
return
return err
}
m.clusters, err = m.GetClusters()
if err != nil {
return
return err
}
return
ticker := time.NewTicker(30 * time.Second)
go func() {
for range ticker.C {
if p, e := m.GetPipelines(); e == nil {
m.pipelines = p
}
if c, e := m.GetClusters(); e == nil {
m.clusters = c
}
}
}()

return nil
}

func (m *PipelineRunsManager) PrintMarkdownPipelineRuns(pr *opsv1.PipelineRun) (output string) {
Expand Down

0 comments on commit 6f51ef9

Please sign in to comment.