Commit 9365859

Eric Bower  ·  2023-08-14 20:24:18 -0400 EDT
parent 173794d
chore: speed it up
1 files changed,  +20, -7
+20, -7
......@@ -533,6 +533,9 @@ func getRefsURL() template.URL {
533533 return template.URL(url)
534534 }
535535
536+// controls the url for trees and logs
537+// /logs/getRevIDForURL()/index.html
538+// /tree/getRevIDForURL()/item/file.x.html
536539 func getRevIDForURL(info RevInfo) string {
537540 return info.Name()
538541 }
......@@ -667,8 +670,12 @@ func (c *Config) writeRepo() *BranchOutput {
667670 SiteURLs: c.getURLs(),
668671 }
669672
670- branchOutput := c.writeRevision(repo, data, refInfoList)
671- if !claimed {
673+ if claimed {
674+ go func() {
675+ c.writeRevision(repo, data, refInfoList)
676+ }()
677+ } else {
678+ branchOutput := c.writeRevision(repo, data, refInfoList)
672679 mainOutput = branchOutput
673680 claimed = true
674681 }
......@@ -742,7 +749,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
742749 var lastCommits []*git.Commit
743750 // `git rev-list` is pretty expensive here, so we have a flag to disable
744751 if pageData.Repo.HideTreeLastCommit {
745- c.Logger.Info("skipping finding last commit for each file")
752+ c.Logger.Info("skipping the process of finding the last commit for each file")
746753 } else {
747754 lastCommits, err = repo.RevList([]string{pageData.RevData.ID()}, git.RevListOptions{
748755 Path: entry.Path,
......@@ -771,11 +778,17 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
771778 pageData.RevData.Name(),
772779 )
773780
774- c.writeLog(pageData, logs)
775- c.writeLogDiffs(repo, pageData, logs)
776- c.writeTree(pageData, treeEntries)
777- readme := c.writeHTMLTreeFiles(pageData, treeEntries)
781+ go func() {
782+ c.writeLog(pageData, logs)
783+ }()
784+ go func() {
785+ c.writeLogDiffs(repo, pageData, logs)
786+ }()
787+ go func() {
788+ c.writeTree(pageData, treeEntries)
789+ }()
778790
791+ readme := c.writeHTMLTreeFiles(pageData, treeEntries)
779792 output.Readme = readme
780793 return output
781794 }