Skip to content

Add a background job to refresh the requirements local cache#12936

Merged
alexsong-oai merged 6 commits intomainfrom
alexs/bg-refresh
Feb 27, 2026
Merged

Add a background job to refresh the requirements local cache#12936
alexsong-oai merged 6 commits intomainfrom
alexs/bg-refresh

Conversation

@alexsong-oai
Copy link
Collaborator

@alexsong-oai alexsong-oai commented Feb 26, 2026

  • Update the cloud requirements cache TTL to 30 minutes.
  • Add a background job to refresh the cache every 5 minutes.
  • Ensure there is only one refresh job per process.

@alexsong-oai alexsong-oai added the oai PRs contributed by OpenAI employees label Feb 26, 2026
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1c3c4adc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
}

async fn refresh_cache(&self) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we just use fetch_with_timeout or somehow dry the logic a little bit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this fn already reuses fetch_with_retries for the core fetch logic. The rest is just deriving the required params.

data: None,
});
}
stop_cloud_requirements_refresher();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can the refresh job detect this and exit on its own (i.e., be more self-maintaining)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe just quit the refresh_cache_in_background loop once self.auth_manager.auth() failed?

@alexsong-oai alexsong-oai enabled auto-merge (squash) February 27, 2026 04:11
@alexsong-oai alexsong-oai merged commit f53612d into main Feb 27, 2026
33 checks passed
@alexsong-oai alexsong-oai deleted the alexs/bg-refresh branch February 27, 2026 04:16
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants