Skip to content

Commit

Permalink
Fix performance issue on the status page
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Apr 2, 2024
1 parent b5e726f commit 245d650
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
24 changes: 2 additions & 22 deletions go/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (

type Exec struct {
UUID uuid.UUID
RawUUID string
AnsibleConfig ansible.Config
Source string
GitRef string
Expand Down Expand Up @@ -456,32 +457,11 @@ func GetRecentExecutions(client storage.SQLClient) ([]*Exec, error) {
}
defer result.Close()
for result.Next() {
var eUUID string
exec := &Exec{}
err = result.Scan(&eUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
err = result.Scan(&exec.RawUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
if err != nil {
return nil, err
}
exec.UUID, err = uuid.Parse(eUUID)
if err != nil {
return nil, err
}
if exec.TypeOf != "micro" {
macroResult, err := client.Select("SELECT m.vtgate_planner_version FROM macrobenchmark m, execution e WHERE e.uuid = m.exec_uuid AND e.uuid = ? LIMIT 1", eUUID)
if err != nil {
return nil, err
}
defer macroResult.Close()

var plannerVersion string
if macroResult.Next() {
err = macroResult.Scan(&plannerVersion)
if err != nil {
return nil, err
}
}
exec.VtgatePlannerVersion = plannerVersion
}
res = append(res, exec)
}
return res, nil
Expand Down
2 changes: 1 addition & 1 deletion go/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Server) getRecentExecutions(c *gin.Context) {
recentExecs := make([]RecentExecutions, 0, len(execs))
for _, e := range execs {
recentExecs = append(recentExecs, RecentExecutions{
UUID: e.UUID.String(),
UUID: e.RawUUID,
Source: e.Source,
GitRef: e.GitRef,
Status: e.Status,
Expand Down

0 comments on commit 245d650

Please sign in to comment.