From d6d5978b6dbba1adffd91ff8b86bd5e8465978f5 Mon Sep 17 00:00:00 2001 From: amine Date: Tue, 19 Nov 2019 20:12:07 +0100 Subject: bridge/launchpad: importer correctly emit NothingEvent --- bridge/launchpad/import.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'bridge/launchpad') diff --git a/bridge/launchpad/import.go b/bridge/launchpad/import.go index 178945b6..59fc5c5f 100644 --- a/bridge/launchpad/import.go +++ b/bridge/launchpad/import.go @@ -103,8 +103,6 @@ func (li *launchpadImporter) ImportAll(ctx context.Context, repo *cache.RepoCach /* Handle messages */ if len(lpBug.Messages) == 0 { - err := fmt.Sprintf("bug doesn't have any comments") - out <- core.NewImportNothing(entity.Id(lpBugID), err) return } @@ -149,8 +147,9 @@ func (li *launchpadImporter) ImportAll(ctx context.Context, repo *cache.RepoCach out <- core.NewImportComment(op.Id()) } - err = b.CommitAsNeeded() - if err != nil { + if !b.NeedCommit() { + out <- core.NewImportNothing(b.Id(), "no imported operation") + } else if err := b.Commit(); err != nil { out <- core.NewImportError(err, "") return } -- cgit