@@ -126,6 +126,7 @@ type App struct {
126126 currentRun * models.WorkflowRun
127127 currentJobs []models.Job
128128 logs string
129+ logsCache map [int64 ]string // runID -> logs (session cache)
129130
130131 // Lists
131132 workflowList list.Model
@@ -219,6 +220,7 @@ func NewApp(client *github.Client, owner, repo string) *App {
219220 allRunsPage : 1 ,
220221 allRunsPerPage : 100 ,
221222 jobsCache : NewJobsCache (10 * time .Minute ),
223+ logsCache : make (map [int64 ]string ),
222224 workflowFileCache : make (map [string ]string ),
223225 }
224226}
@@ -756,6 +758,8 @@ func (a *App) refresh() (tea.Model, tea.Cmd) {
756758 if a .currentRun != nil {
757759 a .logOffset = 0
758760 a .logs = ""
761+ // 強制再取得のためキャッシュ削除
762+ delete (a .logsCache , a .currentRun .ID )
759763 return a , a .loadWorkflowRunLogs (a .currentRun .ID )
760764 }
761765 }
@@ -1322,10 +1326,16 @@ func (a *App) loadWorkflowRuns(workflowID int64) tea.Cmd {
13221326
13231327func (a * App ) loadWorkflowRunLogs (runID int64 ) tea.Cmd {
13241328 return tea .Cmd (func () tea.Msg {
1329+ // キャッシュヒット時は即返す
1330+ if cached , ok := a .logsCache [runID ]; ok {
1331+ return logsLoadedMsg {logs : cached }
1332+ }
13251333 logs , err := a .client .GetWorkflowRunLogs (a .owner , a .repo , runID )
13261334 if err != nil {
13271335 return errorMsg {err : err }
13281336 }
1337+ // キャッシュ保存
1338+ a .logsCache [runID ] = logs
13291339 return logsLoadedMsg {logs : logs }
13301340 })
13311341}
0 commit comments