From 0fd570171d171aa574d7f01d6033a9c01d668465 Mon Sep 17 00:00:00 2001 From: Alexander Scharinger Date: Thu, 8 Apr 2021 23:57:25 +0200 Subject: Improve feedback for user when Github rate limiting The Github bridge itself should not write anything. This commit removes code writing to stdout and itroduces an event `ImportEventRateLimiting` to `core.ImportResult` in order to inform about a rate limiting situation of the Github GraphQL API. Now the communication with the user is delegated to the various user interfaces. --- bridge/github/import.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bridge/github/import.go') diff --git a/bridge/github/import.go b/bridge/github/import.go index 66710d0f..e89f34c4 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -79,8 +79,8 @@ func (gi *githubImporter) ImportAll(ctx context.Context, repo *cache.RepoCache, nextEvent = gi.getEventHandleMsgs() switch event := currEvent.(type) { - case MessageEvent: - fmt.Println(event.msg) + case RateLimitingEvent: + out <- core.NewImportRateLimiting(event.msg) case IssueEvent: // first: commit what is being held in currBug if err = gi.commit(currBug, out); err != nil { @@ -148,9 +148,9 @@ func (gi *githubImporter) getEventHandleMsgs() ImportEvent { for { // read event from import mediator event := gi.mediator.NextImportEvent() - // consume (and use) all message events - if e, ok := event.(MessageEvent); ok { - fmt.Println(e.msg) + // consume (and use) all rate limiting events + if e, ok := event.(RateLimitingEvent); ok { + gi.out <- core.NewImportRateLimiting(e.msg) continue } return event -- cgit