Skip to content

Commit

Permalink
Merge pull request #18474 from mozilla/FXA-9987
Browse files Browse the repository at this point in the history
fix(cirrus): Do not throw an exception for user request timeouts
  • Loading branch information
jonalmeida authored Mar 3, 2025
2 parents 014c800 + e2c6653 commit 384431d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/fxa-content-server/app/scripts/lib/nimbus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default class Nimbus {
const resp = await fetch('/nimbus-experiments', {
method: 'POST',
body,
// A request to cirrus should not be more than 50ms, but we give it a large enough padding.
// A request to cirrus should not be more than 50ms,
// but this timeout is public-facing so may take longer.
signal: AbortSignal.timeout(1000),
headers: {
'Content-Type': 'application/json',
Expand All @@ -31,9 +32,17 @@ export default class Nimbus {

this.experiments = await resp.json();
} catch (err) {
if (err.name === 'TimeoutError') {
// We can't do much here if we're reaching timeouts from network issues.
return;
}

Sentry.withScope(() => {
Sentry.captureMessage('Experiment fetch error', 'error');
});

// Finally, always clear out the experiments;
this.experiments = null;
}
}
}

0 comments on commit 384431d

Please sign in to comment.