diff --git a/pkg/retry/retry.go b/pkg/retry/retry.go index faa2cdf..b3a2f56 100644 --- a/pkg/retry/retry.go +++ b/pkg/retry/retry.go @@ -125,6 +125,12 @@ func (s *Server) handleRetry() http.Handler { return } + if len(deliveries) == 0 { + logger.InfoContext(ctx, "no deliveries from GitHub", + "cursor", cursor) + break + } + // in anticipation of the happy path, store the first event to advance the // cursor if firstCheckpoint == "" { diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index ab6b6d9..774d6ea 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -126,6 +126,21 @@ func TestHandleRetry(t *testing.T) { listDeliveries: &listDeliveriesRes{err: errors.New("error")}, }, }, + { + name: "github_list_deliveries_empty", + expStatusCode: http.StatusAccepted, + expRespBody: `{"status":"accepted"}`, + datastoreClientOverride: &MockDatastore{ + retrieveCheckpointID: &retrieveCheckpointIDRes{res: "checkpoint-id"}, + }, + gcsLockClientOverride: &MockLock{ + acquire: &acquireRes{}, + }, + githubOverride: &MockGitHub{ + listDeliveries: &listDeliveriesRes{deliveries: []*github.HookDelivery{}, + res: &github.Response{}}, + }, + }, { name: "github_redeliver_event_failure_big_query_entry_not_exists", expStatusCode: http.StatusInternalServerError,