Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: go/src/infra/tools/cipd/apps/cipd/friendly.go

Issue 1381583007: cipd: Implement local cache for ResolveVersion(...) call with tags. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@cipd-init
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | go/src/infra/tools/cipd/apps/cipd/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/tools/cipd/apps/cipd/friendly.go
diff --git a/go/src/infra/tools/cipd/apps/cipd/friendly.go b/go/src/infra/tools/cipd/apps/cipd/friendly.go
index 9a5daf994d0e04939cacc9d882695a02bbfa60d9..700455b418fec506f552d66ae27488fc8c1767b4 100644
--- a/go/src/infra/tools/cipd/apps/cipd/friendly.go
+++ b/go/src/infra/tools/cipd/apps/cipd/friendly.go
@@ -208,6 +208,14 @@ func (site *installationSite) initClient(authFlags authcli.Flags) (err error) {
return
}
+// closeClient closes the underlying cipd.Client if necessary.
+func (site *installationSite) closeClient() {
+ if site.client != nil {
+ site.client.Close()
+ site.client = nil
+ }
+}
+
// modifyConfig reads config file, calls callback to mutate it, then writes
// it back.
func (site *installationSite) modifyConfig(cb func(cfg *installationSiteConfig) error) error {
@@ -461,6 +469,7 @@ func (c *installRun) Run(a subcommands.Application, args []string) int {
if err = site.initClient(c.authFlags); err != nil {
return c.done(nil, err)
}
+ defer site.closeClient()
return c.done(site.installPackage(pkgName, version, c.force))
}
« no previous file with comments | « no previous file | go/src/infra/tools/cipd/apps/cipd/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698