7a30848386eb95478ec66165f01e06e6658ea970

Author
Toby Padilla <toby@charm.sh>
Committer
Toby Padilla <toby@charm.sh>
Date

Message

Add logging to track repo loading

Diff

 1diff --git a/tui/bubbles/repo/bubble.go b/tui/bubbles/repo/bubble.go
 2index b2562fe57a4593e9edf3bbda0d8a83d2bf3df738..f75d7c52cc887ae6fba51039b3606430b896b4d9 100644
 3--- a/tui/bubbles/repo/bubble.go
 4+++ b/tui/bubbles/repo/bubble.go
 5@@ -3,10 +3,12 @@ package repo
 6 import (
 7 	"bytes"
 8 	"fmt"
 9+	"log"
10 	"soft-serve/git"
11 	"soft-serve/tui/style"
12 	"strconv"
13 	"text/template"
14+	"time"
15 
16 	"github.com/charmbracelet/bubbles/viewport"
17 	tea "github.com/charmbracelet/bubbletea"
18@@ -158,6 +160,7 @@ func (b Bubble) sshAddress() string {
19 }
20 
21 func (b *Bubble) setupCmd() tea.Msg {
22+	ct := time.Now()
23 	r, err := b.repoSource.GetRepo(b.name)
24 	if err == git.ErrMissingRepo {
25 		return nil
26@@ -179,6 +182,7 @@ func (b *Bubble) setupCmd() tea.Msg {
27 	}
28 	b.readmeViewport.Viewport.SetContent(md)
29 	b.GotoTop()
30+	log.Printf("Repo bubble loaded in %s", time.Since(ct))
31 	return nil
32 }
33 
34diff --git a/tui/commands.go b/tui/commands.go
35index 6deb2832f373871609c61b8cd53a6993528d4148..7e305afe732de7e5e90b868a10678bf0255ad9f8 100644
36--- a/tui/commands.go
37+++ b/tui/commands.go
38@@ -2,8 +2,10 @@ package tui
39 
40 import (
41 	"fmt"
42+	"log"
43 	"soft-serve/tui/bubbles/repo"
44 	"soft-serve/tui/bubbles/selection"
45+	"time"
46 
47 	tea "github.com/charmbracelet/bubbletea"
48 	"github.com/charmbracelet/lipgloss"
49@@ -18,6 +20,7 @@ func (e errMsg) Error() string {
50 }
51 
52 func (b *Bubble) setupCmd() tea.Msg {
53+	ct := time.Now()
54 	lipgloss.SetColorProfile(termenv.ANSI256)
55 	b.repos = b.repoSource.AllRepos()
56 	mes := make([]MenuEntry, 0)
57@@ -80,5 +83,6 @@ func (b *Bubble) setupCmd() tea.Msg {
58 		b.activeBox = 1
59 	}
60 	b.state = loadedState
61+	log.Printf("App bubble loaded in %s", time.Since(ct))
62 	return nil
63 }
64diff --git a/tui/session.go b/tui/session.go
65index 0110cc0e0bc71ddf3ca579d3f3e08a420935d45b..ee72119792bc9d4dadb9dd28af8d817511fd9b51 100644
66--- a/tui/session.go
67+++ b/tui/session.go
68@@ -28,6 +28,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session)
69 	go func() {
70 		for {
71 			time.Sleep(repoPoll)
72+			ct := time.Now()
73 			err := rs.LoadRepos()
74 			if err != nil {
75 				log.Printf("cannot load repos: %s", err)
76@@ -40,6 +41,7 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session)
77 					continue
78 				}
79 			}
80+			log.Printf("Repos loaded in %s", time.Since(ct))
81 			appCfg = cfg
82 		}
83 	}()