Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Commit

Permalink
Defer ListVersions() on already-fetched git repos
Browse files Browse the repository at this point in the history
This was causing potentially unnecessary network activity, as well as
placing a block that effectively serialized slow points in the solving
algorithm.
  • Loading branch information
sdboyer committed Dec 24, 2016
1 parent e4435f5 commit 4815cd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 10 additions & 8 deletions maybe_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ func (m maybeGitSource) try(cachedir string, an ProjectAnalyzer) (source, string
}

src.baseVCSSource.lvfunc = src.listVersions

_, err = src.listVersions()
if err != nil {
return nil, "", err
if !r.CheckLocal() {
_, err = src.listVersions()
if err != nil {
return nil, "", err
}
}

return src, ustr, nil
Expand Down Expand Up @@ -129,10 +130,11 @@ func (m maybeGopkginSource) try(cachedir string, an ProjectAnalyzer) (source, st
}

src.baseVCSSource.lvfunc = src.listVersions

_, err = src.listVersions()
if err != nil {
return nil, "", err
if !r.CheckLocal() {
_, err = src.listVersions()
if err != nil {
return nil, "", err
}
}

return src, ustr, nil
Expand Down
1 change: 0 additions & 1 deletion source_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ func (sm *SourceMgr) DeduceProjectRoot(ip string) (ProjectRoot, error) {
}

func (sm *SourceMgr) getSourceFor(id ProjectIdentifier) (source, error) {
//pretty.Println(id.ProjectRoot)
nn := id.netName()

sm.srcmut.RLock()
Expand Down

0 comments on commit 4815cd5

Please sign in to comment.