Skip to content

Commit

Permalink
Add logging to track repo loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby Padilla committed Sep 20, 2021
1 parent 4faaf47 commit 7a30848
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tui/bubbles/repo/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package repo
import (
"bytes"
"fmt"
"log"
"soft-serve/git"
"soft-serve/tui/style"
"strconv"
"text/template"
"time"

"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
Expand Down Expand Up @@ -158,6 +160,7 @@ func (b Bubble) sshAddress() string {
}

func (b *Bubble) setupCmd() tea.Msg {
ct := time.Now()
r, err := b.repoSource.GetRepo(b.name)
if err == git.ErrMissingRepo {
return nil
Expand All @@ -179,6 +182,7 @@ func (b *Bubble) setupCmd() tea.Msg {
}
b.readmeViewport.Viewport.SetContent(md)
b.GotoTop()
log.Printf("Repo bubble loaded in %s", time.Since(ct))
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions tui/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package tui

import (
"fmt"
"log"
"soft-serve/tui/bubbles/repo"
"soft-serve/tui/bubbles/selection"
"time"

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
Expand All @@ -18,6 +20,7 @@ func (e errMsg) Error() string {
}

func (b *Bubble) setupCmd() tea.Msg {
ct := time.Now()
lipgloss.SetColorProfile(termenv.ANSI256)
b.repos = b.repoSource.AllRepos()
mes := make([]MenuEntry, 0)
Expand Down Expand Up @@ -80,5 +83,6 @@ func (b *Bubble) setupCmd() tea.Msg {
b.activeBox = 1
}
b.state = loadedState
log.Printf("App bubble loaded in %s", time.Since(ct))
return nil
}
2 changes: 2 additions & 0 deletions tui/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session)
go func() {
for {
time.Sleep(repoPoll)
ct := time.Now()
err := rs.LoadRepos()
if err != nil {
log.Printf("cannot load repos: %s", err)
Expand All @@ -40,6 +41,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session)
continue
}
}
log.Printf("Repos loaded in %s", time.Since(ct))
appCfg = cfg
}
}()
Expand Down

0 comments on commit 7a30848

Please sign in to comment.