Commit 9365859
Eric Bower
·
2023-08-14 20:24:18 -0400 EDT
parent 173794d
chore: speed it up
1 files changed,
+20,
-7
M
main.go
M
main.go
+20,
-7
| ... | ... | @@ -533,6 +533,9 @@ func getRefsURL() template.URL { | |
| 533 | 533 | return template.URL(url) | |
| 534 | 534 | } | |
| 535 | 535 | ||
| 536 | + | // controls the url for trees and logs | |
| 537 | + | // /logs/getRevIDForURL()/index.html | |
| 538 | + | // /tree/getRevIDForURL()/item/file.x.html | |
| 536 | 539 | func getRevIDForURL(info RevInfo) string { | |
| 537 | 540 | return info.Name() | |
| 538 | 541 | } |
| ... | ... | @@ -667,8 +670,12 @@ func (c *Config) writeRepo() *BranchOutput { | |
| 667 | 670 | SiteURLs: c.getURLs(), | |
| 668 | 671 | } | |
| 669 | 672 | ||
| 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) | |
| 672 | 679 | mainOutput = branchOutput | |
| 673 | 680 | claimed = true | |
| 674 | 681 | } |
| ... | ... | @@ -742,7 +749,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs [] | |
| 742 | 749 | var lastCommits []*git.Commit | |
| 743 | 750 | // `git rev-list` is pretty expensive here, so we have a flag to disable | |
| 744 | 751 | 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") | |
| 746 | 753 | } else { | |
| 747 | 754 | lastCommits, err = repo.RevList([]string{pageData.RevData.ID()}, git.RevListOptions{ | |
| 748 | 755 | Path: entry.Path, |
| ... | ... | @@ -771,11 +778,17 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs [] | |
| 771 | 778 | pageData.RevData.Name(), | |
| 772 | 779 | ) | |
| 773 | 780 | ||
| 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 | + | }() | |
| 778 | 790 | ||
| 791 | + | readme := c.writeHTMLTreeFiles(pageData, treeEntries) | |
| 779 | 792 | output.Readme = readme | |
| 780 | 793 | return output | |
| 781 | 794 | } |