aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core
diff options
context:
space:
mode:
authorrng-dynamics <73444470+rng-dynamics@users.noreply.github.com>2021-09-14 22:22:28 +0200
committerGitHub <noreply@github.com>2021-09-14 22:22:28 +0200
commit247e1a865db29a3189acfd89cde776a52a7ebaac (patch)
treea214a05c91c3a859eaaae621665492b24f776991 /bridge/core
parent58e6aec77f27214d7ba457ad709eedb0fc2f907b (diff)
downloadgit-bug-247e1a865db29a3189acfd89cde776a52a7ebaac.tar.gz
feature: Github bridge mutation rate limit (#694)
Unified handling of rate limiting of github graphql api
Diffstat (limited to 'bridge/core')
-rw-r--r--bridge/core/export.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/bridge/core/export.go b/bridge/core/export.go
index fa531c5f..6e0612fa 100644
--- a/bridge/core/export.go
+++ b/bridge/core/export.go
@@ -31,6 +31,9 @@ const (
// but not severe enough to consider the export a failure.
ExportEventWarning
+ // The export system (web API) has reached a rate limit
+ ExportEventRateLimiting
+
// Error happened during export
ExportEventError
)
@@ -74,6 +77,8 @@ func (er ExportResult) String() string {
return fmt.Sprintf("warning at %s: %s", er.ID, er.Err.Error())
}
return fmt.Sprintf("warning: %s", er.Err.Error())
+ case ExportEventRateLimiting:
+ return fmt.Sprintf("rate limiting: %s", er.Reason)
default:
panic("unknown export result")
@@ -145,3 +150,10 @@ func NewExportTitleEdition(id entity.Id) ExportResult {
Event: ExportEventTitleEdition,
}
}
+
+func NewExportRateLimiting(msg string) ExportResult {
+ return ExportResult{
+ Reason: msg,
+ Event: ExportEventRateLimiting,
+ }
+}