Merge pull request #272 from MichaelMure/fix-import-time-save

bridge: fix incorrect last import time on context cancel
This commit is contained in:
Amine 2019-12-09 15:22:14 +01:00 committed by GitHub
commit 69af7a1e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -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, "")
}
}()

View File

@ -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())
}
}