From 8f7f89561b59a0988d56bc41a30093730e35f70e Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 9 Dec 2019 01:03:37 +0100 Subject: bridge: fix incorrect last import time on context cancel --- bridge/github/import.go | 2 +- commands/bridge_pull.go | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bridge/github/import.go b/bridge/github/import.go index c0fb3d6c..67ab9351 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -78,7 +78,7 @@ func (gi *githubImporter) ImportAll(ctx context.Context, repo *cache.RepoCache, } } - if err := gi.iterator.Error(); err != nil && err != context.Canceled { + if err := gi.iterator.Error(); err != nil { gi.out <- core.NewImportError(err, "") } }() diff --git a/commands/bridge_pull.go b/commands/bridge_pull.go index 67f19024..2dd3d93e 100644 --- a/commands/bridge_pull.go +++ b/commands/bridge_pull.go @@ -96,15 +96,25 @@ func runBridgePull(cmd *cobra.Command, args []string) error { importedIssues := 0 importedIdentities := 0 for result := range events { - if result.Event != core.ImportEventNothing { - fmt.Println(result.String()) - } - switch result.Event { + case core.ImportEventNothing: + // filtered + case core.ImportEventBug: importedIssues++ + fmt.Println(result.String()) + case core.ImportEventIdentity: importedIdentities++ + fmt.Println(result.String()) + + case core.ImportEventError: + if result.Err != context.Canceled { + fmt.Println(result.String()) + } + + default: + fmt.Println(result.String()) } } -- cgit