diff options
author | Alexander Scharinger <rng.dynamics@gmail.com> | 2021-04-08 23:57:25 +0200 |
---|---|---|
committer | Alexander Scharinger <rng.dynamics@gmail.com> | 2021-04-08 23:57:25 +0200 |
commit | 0fd570171d171aa574d7f01d6033a9c01d668465 (patch) | |
tree | 56a055130e3c2da01cdec080c960977da5738db6 /bridge/core | |
parent | ede5e218ac4ae492f06be9d3bb8a1e9463eda739 (diff) | |
download | git-bug-0fd570171d171aa574d7f01d6033a9c01d668465.tar.gz |
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.
Diffstat (limited to 'bridge/core')
-rw-r--r-- | bridge/core/import.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bridge/core/import.go b/bridge/core/import.go index 0b0b4c68..c1965d4e 100644 --- a/bridge/core/import.go +++ b/bridge/core/import.go @@ -34,6 +34,9 @@ const ( // but not severe enough to consider the import a failure. ImportEventWarning + // The import system (web API) has reached the rate limit + ImportEventRateLimiting + // Error happened during import ImportEventError ) @@ -87,6 +90,8 @@ func (er ImportResult) String() string { parts = append(parts, fmt.Sprintf("err: %s", er.Err)) } return strings.Join(parts, " ") + case ImportEventRateLimiting: + return fmt.Sprintf("rate limiting: %s", er.Reason) default: panic("unknown import result") @@ -165,3 +170,10 @@ func NewImportIdentity(id entity.Id) ImportResult { Event: ImportEventIdentity, } } + +func NewImportRateLimiting(msg string) ImportResult { + return ImportResult{ + Reason: msg, + Event: ImportEventRateLimiting, + } +} |