Skip to content

CXP-533 Cap event feed lookback to 90 days to prevent timeout#108

Merged
JavierCarnelli-ConductorOne merged 2 commits into
mainfrom
fix/cxp-533
May 27, 2026
Merged

CXP-533 Cap event feed lookback to 90 days to prevent timeout#108
JavierCarnelli-ConductorOne merged 2 commits into
mainfrom
fix/cxp-533

Conversation

@JavierCarnelli-ConductorOne
Copy link
Copy Markdown
Contributor

@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne commented May 26, 2026

Google page tokens expire after ~24h. A cursor left mid-pagination would keep requesting the full historical window on every retry, causing HTTP timeouts on large orgs. Enforce a 90-day cutoff in unmarshalPageToken: clamp defaultStart and reset stale or unparseable cursors, clearing the expired NextPageToken so the next call starts fresh from the cutoff.

Google page tokens expire after ~24h. A cursor left mid-pagination would
keep requesting the full historical window on every retry, causing HTTP
timeouts on large orgs. Enforce a 31-day cutoff in unmarshalPageToken:
clamp defaultStart and reset stale or unparseable cursors, clearing the
expired NextPageToken so the next call starts fresh from the cutoff.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 26, 2026

CXP-533

Comment on lines +108 to +113
cutoff := time.Now().Add(-maxEventFeedLookback)
if defaultStart == nil || defaultStart.AsTime().Before(cutoff) {
// There's lag on these events, so we're going to start roughly when google says events should come in
// https://support.google.com/a/answer/7061566?fl=1&sjid=13551023455982018638-NC (Data Retention and Lag Times)
defaultStart = timestamppb.New(cutoff)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The original code defaulted to a 2-hour lookback for fresh starts (nil defaultStart, empty cursor) to match Google's documented event delivery lag. This change widens that default to 31 days, which on large orgs could cause the same timeout issue the PR aims to prevent. Consider preserving the 2-hour default for fresh starts while clamping only stale cursors and caller-provided start times to 31 days.

The Google lag-time comment (carried over from the original) was written for the 2-hour window and is misleading when applied to the 31-day cutoff.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C1 always provides a value, so I would be surprised if we ever hit the 2-hour window. Two hours is too small for useful usage data, so that really wasn't a good default to begin with.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Connector PR Review: CXP-533 Cap event feed lookback to 90 days to prevent timeout

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: incremental since 17791a4
View review run

Review Summary

The new commit widens maxEventFeedLookback from 31 days to 90 days and updates the accompanying comment. This is a straightforward constant change with no structural or logic changes. The previous suggestion about fresh-start lookback (nil defaultStart using the full lookback window instead of 2 hours) remains applicable but was already raised in the prior review — no new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Copy link
Copy Markdown
Contributor

@FeliLucero1 FeliLucero1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth looking at the bot comment

@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne changed the title CXP-533 Cap event feed lookback to 31 days to prevent timeout CXP-533 Cap event feed lookback to 90 days to prevent timeout May 27, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne merged commit acda3e9 into main May 27, 2026
11 of 12 checks passed
@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne deleted the fix/cxp-533 branch May 27, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants