Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(devex): move github clients off critical where a shed is handled (#115278)

Julian Bez235e160def1d
diff --git a/posthog/api/github_callback/personal_state.py b/posthog/api/github_callback/personal_state.py
index dcd29012b33e..7db51688e14a 100644
--- a/posthog/api/github_callback/personal_state.py
+++ b/posthog/api/github_callback/personal_state.py
@@ -104,7 +104,7 @@ def list_user_github_app_installations(
token = credential.token
if discovery:
discovery.login = UserGitHubIntegration(
- credential.integration, source="github_callback", priority=Priority.CRITICAL
+ credential.integration, source="github_callback", priority=Priority.NORMAL
).github_login
discovery.audit.record(
"discovery_credential_selected",
diff --git a/posthog/api/github_callback/team_services.py b/posthog/api/github_callback/team_services.py
index bc2eb71f51db..babf83513401 100644
--- a/posthog/api/github_callback/team_services.py
+++ b/posthog/api/github_callback/team_services.py
@@ -269,7 +269,7 @@ def adopt_orphan_installation(
instance = GitHubIntegration.integration_from_installation_id(installation_id, team.id, user)
login = UserGitHubIntegration(
- credential.integration, source="github_callback", priority=Priority.CRITICAL
+ credential.integration, source="github_callback", priority=Priority.NORMAL
).github_login
if login:
instance.config["connecting_user_github_login"] = login
@@ -637,7 +637,7 @@ def _sibling_installation_account(integration: Integration) -> _InstallationAcco
stranger's account in their settings. Missing names use the installation ID fallback so discovery
does not wait for a GitHub metadata request for each sibling installation.
"""
- github_integration = GitHubIntegration(integration, source="github_callback", priority=Priority.CRITICAL)
+ github_integration = GitHubIntegration(integration, source="github_callback", priority=Priority.NORMAL)
account = (integration.config or {}).get("account") or {}
name = account.get("name")
if not name or str(name) == str(github_integration.github_installation_id):
diff --git a/posthog/api/integration.py b/posthog/api/integration.py
index 0cc5d97f7928..e0143d0270c0 100644
--- a/posthog/api/integration.py
+++ b/posthog/api/integration.py
@@ -785,7 +785,7 @@ class IntegrationSerializer(serializers.ModelSerializer, UserAccessControlSerial
return None
return (
"unavailable"
- if GitHubIntegration(obj, source="integrations_api", priority=Priority.CRITICAL).installation_unavailable()
+ if GitHubIntegration(obj, source="integrations_api", priority=Priority.NORMAL).installation_unavailable()
else "connected"
)
@@ -2787,7 +2787,7 @@ class IntegrationViewSet(
instances = page if page is not None else list(queryset)
for instance in instances:
if instance.kind == "github":
- GitHubIntegration(instance, source="integrations_api", priority=Priority.CRITICAL).ensure_account_name()
+ GitHubIntegration(instance, source="integrations_api", priority=Priority.NORMAL).ensure_account_name()
# One grouped lookup for the whole page instead of an `exists()` per row, so
# `installation_shared` stays a fixed one query however many GitHub rows there are.
reference_counts = GitHubIntegration.installation_reference_counts(
@@ -2812,5 +2812,5 @@ class IntegrationViewSet(
# second query and permission check for the row already in hand.
instance = self.get_object()
if instance.kind == "github":
- GitHubIntegration(instance, source="integrations_api", priority=Priority.CRITICAL).ensure_account_name()
+ GitHubIntegration(instance, source="integrations_api", priority=Priority.NORMAL).ensure_account_name()
return Response(self.get_serializer(instance).data)
diff --git a/posthog/api/user_integration.py b/posthog/api/user_integration.py
index f4e657bf9135..dbf38237e0e3 100644
--- a/posthog/api/user_integration.py
+++ b/posthog/api/user_integration.py
@@ -425,7 +425,7 @@ class UserIntegrationViewSet(viewsets.GenericViewSet):
for integration in integrations:
if integration.kind == "github":
UserGitHubIntegration(
- integration, source="user_integrations_api", priority=Priority.CRITICAL
+ integration, source="user_integrations_api", priority=Priority.NORMAL
).ensure_account_name()
results.append(
_serialize_github_integration(
@@ -997,7 +997,7 @@ def _serialize_github_integration(
installation_reference_counts: dict[str, int],
) -> dict[str, Any]:
"""Build the response payload for a single GitHub UserIntegration."""
- github = UserGitHubIntegration(integration, source="user_integrations_api", priority=Priority.CRITICAL)
+ github = UserGitHubIntegration(integration, source="user_integrations_api", priority=Priority.NORMAL)
# Mirrors github_destroy's uninstall_if_last_reference: any other row, team or personal, keeps the
# App installed on GitHub after this one is deleted. The precomputed map counts every reference
# for the installation including this row, so more than one means another row still shares it.
diff --git a/posthog/models/user.py b/posthog/models/user.py
index a8204d3b4fee..2ebdc82d8dc1 100644
--- a/posthog/models/user.py
+++ b/posthog/models/user.py
@@ -532,7 +532,7 @@ class User(AbstractUser, UUIDTClassicModel, ModelActivityMixin): # type: ignore
for user_integration in user_integrations:
login = UserGitHubIntegration(
- user_integration, source="user_github_login", priority=Priority.CRITICAL
+ user_integration, source="user_github_login", priority=Priority.NORMAL
).github_login
if login:
return login
diff --git a/posthog/session_recordings/session_recording_external_reference_api.py b/posthog/session_recordings/session_recording_external_reference_api.py
index 0b04f2fa1a50..4114768f73c9 100644
--- a/posthog/session_recordings/session_recording_external_reference_api.py
+++ b/posthog/session_recordings/session_recording_external_reference_api.py
@@ -76,7 +76,7 @@ class SessionRecordingExternalReferenceSerializer(serializers.ModelSerializer):
return f"https://linear.app/{url_key}/issue/{external_context['id']}"
elif reference.integration.kind == Integration.IntegrationKind.GITHUB:
org = GitHubIntegration(
- reference.integration, source="replay_external_references", priority=Priority.CRITICAL
+ reference.integration, source="replay_external_references", priority=Priority.NORMAL
).organization()
repository = external_context.get("repository", "")
issue_number = external_context.get("id", "").lstrip("#")
diff --git a/products/business_knowledge/backend/github_repos.py b/products/business_knowledge/backend/github_repos.py
index c32bdf6bdf19..0b8756bc58c2 100644
--- a/products/business_knowledge/backend/github_repos.py
+++ b/products/business_knowledge/backend/github_repos.py
@@ -244,7 +244,7 @@ def read_repository_file(team: Team, user: User, repo: str, path: str) -> Reposi
def _fetch_file(team: Team, integration: Integration, full_name: str, path: str, sha: str) -> RepositoryFile:
try:
payload = GitHubIntegration(
- integration, source="business_knowledge", priority=Priority.CRITICAL
+ integration, source="business_knowledge", priority=Priority.NORMAL
).get_file_contents(full_name, _quote_github_path(path), ref=sha)
except UnicodeDecodeError:
raise GithubReposError("That file is not text.")
@@ -347,7 +347,7 @@ def _installation_repo_names(integration: Integration) -> set[str]:
# A pure read of the stored repository list, so a repository removed from the installation
# stops being searchable as soon as that list refreshes, even while its cache row remains.
listed = GitHubIntegration(
- integration, source="business_knowledge", priority=Priority.CRITICAL
+ integration, source="business_knowledge", priority=Priority.NORMAL
).list_all_cached_repositories(allow_refresh=False)
return {
item["full_name"].lower()
@@ -371,7 +371,7 @@ def _validate_against_installation(team_id: int, integration_id: int, repos: lis
integration = _integration_for(team_id, integration_id)
if integration is None:
raise GithubReposError("GitHub installation not found on this project.")
- github = GitHubIntegration(integration, source="business_knowledge", priority=Priority.CRITICAL)
+ github = GitHubIntegration(integration, source="business_knowledge", priority=Priority.NORMAL)
try:
listed = github.list_all_cached_repositories()
# Without a cached snapshot the refresh re-raises whatever the sync hit, not only GitHub errors.
diff --git a/products/canvas/backend/connectors.py b/products/canvas/backend/connectors.py
index 5199c960486b..a72824f1a2c4 100644
--- a/products/canvas/backend/connectors.py
+++ b/products/canvas/backend/connectors.py
@@ -188,7 +188,7 @@ class GitHubGetFileContentsPayloadSerializer(GitHubRepositorySerializer):
def _github_client(integration: UserIntegration) -> UserGitHubIntegration:
- return UserGitHubIntegration(integration, source=_GITHUB_SOURCE, priority=Priority.CRITICAL)
+ return UserGitHubIntegration(integration, source=_GITHUB_SOURCE, priority=Priority.NORMAL)
def _github_repo_path(client: UserGitHubIntegration, repository: str) -> str:
diff --git a/products/engineering_analytics/backend/logic/census.py b/products/engineering_analytics/backend/logic/census.py
index 91b68acc2daa..4e657f0471eb 100644
--- a/products/engineering_analytics/backend/logic/census.py
+++ b/products/engineering_analytics/backend/logic/census.py
@@ -44,7 +44,7 @@ def collect_repo_census(repository: str, access_token: str, *, timeout: int = 30
timeout=timeout,
allow_redirects=True,
stream=True,
- priority=Priority.CRITICAL,
+ priority=Priority.BATCH,
)
) as response:
raise_if_github_rate_limited(response)
diff --git a/products/engineering_analytics/backend/logic/job_logs/activity.py b/products/engineering_analytics/backend/logic/job_logs/activity.py
index 3501aa94391c..3eb2b273076c 100644
--- a/products/engineering_analytics/backend/logic/job_logs/activity.py
+++ b/products/engineering_analytics/backend/logic/job_logs/activity.py
@@ -94,7 +94,7 @@ def _resolve_credentials(team_id: int, integration_id: int) -> tuple[str, str, s
the owning team's project API token — the OTLP Bearer that routes emitted logs to that team's Logs.
"""
integration = Integration.objects.get(id=integration_id, team_id=team_id, kind="github")
- github = GitHubIntegration(integration, source="job_logs", priority=Priority.CRITICAL)
+ github = GitHubIntegration(integration, source="job_logs", priority=Priority.BATCH)
if github.access_token_expired():
github.refresh_access_token()
if not integration.access_token:
diff --git a/products/error_tracking/backend/logic/github_external_references.py b/products/error_tracking/backend/logic/github_external_references.py
index abdee8483386..73469a72e77c 100644
--- a/products/error_tracking/backend/logic/github_external_references.py
+++ b/products/error_tracking/backend/logic/github_external_references.py
@@ -191,7 +191,7 @@ def link_reference(job: contracts.GitHubExternalReferenceJob) -> bool:
return False
try:
integration_owner = GitHubIntegration(
- integration, source="error_tracking", priority=Priority.CRITICAL
+ integration, source="error_tracking", priority=Priority.BATCH
).organization()
except ValueError:
return False
diff --git a/products/error_tracking/backend/presentation/views/git_provider_file_link_resolver.py b/products/error_tracking/backend/presentation/views/git_provider_file_link_resolver.py
index 3da103d3467e..ee6afe2f23e6 100644
--- a/products/error_tracking/backend/presentation/views/git_provider_file_link_resolver.py
+++ b/products/error_tracking/backend/presentation/views/git_provider_file_link_resolver.py
@@ -302,7 +302,7 @@ class GitProviderFileLinksViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
integration = Integration.objects.filter(team_id=self.team.id, kind="github").first()
if integration:
- github = GitHubIntegration(integration, source="error_tracking", priority=Priority.CRITICAL)
+ github = GitHubIntegration(integration, source="error_tracking", priority=Priority.NORMAL)
if github.access_token_expired():
github.refresh_access_token()
diff --git a/products/growth/dags/github_sdk_versions.py b/products/growth/dags/github_sdk_versions.py
index f9b79ba89d6e..de95273aac00 100644
--- a/products/growth/dags/github_sdk_versions.py
+++ b/products/growth/dags/github_sdk_versions.py
@@ -174,7 +174,7 @@ def fetch_releases_from_repo(repo: str, skip_cache: bool = False) -> list[Any]:
logger.info(f"[SDK Health] Fetching releases from {url}")
# Identity-blind, unauthenticated call — records volume telemetry, no installation budget.
- response = github_request("GET", url, source="growth", timeout=10, priority=Priority.CRITICAL)
+ response = github_request("GET", url, source="growth", timeout=10, priority=Priority.BATCH)
if not response.ok:
logger.error(f"[SDK Health] Failed to fetch releases for {repo}", status_code=response.status_code)
diff --git a/products/review_hog/backend/api/project_settings.py b/products/review_hog/backend/api/project_settings.py
index 8ddf5c383349..92417a0c3057 100644
--- a/products/review_hog/backend/api/project_settings.py
+++ b/products/review_hog/backend/api/project_settings.py
@@ -345,7 +345,7 @@ class ReviewProjectSettingsViewSet(ReviewHogProjectViewSetMixin, viewsets.Generi
)
try:
repositories = GitHubIntegration(
- integration, source="review_hog", priority=Priority.CRITICAL
+ integration, source="review_hog", priority=Priority.NORMAL
).list_all_cached_repositories()
except Exception:
# The list refreshes from GitHub when the cache is cold, and GitHub can fail or rate limit.
diff --git a/products/review_hog/backend/repository_settings.py b/products/review_hog/backend/repository_settings.py
index a62a56a13187..35bb4f2abe72 100644
--- a/products/review_hog/backend/repository_settings.py
+++ b/products/review_hog/backend/repository_settings.py
@@ -119,7 +119,7 @@ class ProjectRepositories:
integration = self.integration_for(ref.installation_id)
try:
repositories = GitHubIntegration(
- integration, source="review_hog", priority=Priority.CRITICAL
+ integration, source="review_hog", priority=Priority.NORMAL
).list_all_cached_repositories()
except Exception:
# The list refreshes from GitHub when the cache is cold, and GitHub can fail or rate limit.
diff --git a/products/review_hog/backend/reviewer/outcomes/classify.py b/products/review_hog/backend/reviewer/outcomes/classify.py
index 32b9e484f43f..69a04a6857c5 100644
--- a/products/review_hog/backend/reviewer/outcomes/classify.py
+++ b/products/review_hog/backend/reviewer/outcomes/classify.py
@@ -130,7 +130,7 @@ def _installation_auth(team_id: int, repository: str) -> tuple[str, str | None]
skip-this-report condition for the batch, not a failure.
"""
github = GitHubIntegration.first_for_team_repository(
- team_id, repository, source="review_hog", priority=Priority.CRITICAL
+ team_id, repository, source="review_hog", priority=Priority.BATCH
)
if github is None:
return None
diff --git a/products/signals/backend/pull_request_body.py b/products/signals/backend/pull_request_body.py
index 0c580ecdce4c..7651be250c04 100644
--- a/products/signals/backend/pull_request_body.py
+++ b/products/signals/backend/pull_request_body.py
@@ -51,7 +51,7 @@ def edit_pull_request_body(
if parsed is None:
return BodyEditOutcome.SKIPPED
github = GitHubIntegration.first_for_team_repository(
- team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.CRITICAL
+ team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.BATCH
)
if github is None:
# The lookup also returns None when the access check hits a transient GitHub error.
diff --git a/products/signals/backend/pull_request_label.py b/products/signals/backend/pull_request_label.py
index 8a6bd0383d48..7d9a746adeb7 100644
--- a/products/signals/backend/pull_request_label.py
+++ b/products/signals/backend/pull_request_label.py
@@ -103,7 +103,7 @@ def apply_pull_request_label(*, team_id: int, report_id: str, pr_url: str) -> st
log = logger.bind(team_id=team_id, report_id=report_id, repository=parsed.repository, pr_number=parsed.number)
try:
github = GitHubIntegration.first_for_team_repository(
- team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.CRITICAL
+ team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.BATCH
)
except Exception:
log.exception("signals.pull_request_label.integration_lookup_failed")
diff --git a/products/signals/backend/report_assignments.py b/products/signals/backend/report_assignments.py
index 6948a3f7485a..d254c81cb1e4 100644
--- a/products/signals/backend/report_assignments.py
+++ b/products/signals/backend/report_assignments.py
@@ -199,7 +199,7 @@ def _pull_request_details(team_id: int, pr_url: str) -> PullRequestDetails:
)
try:
github = GitHubIntegration.first_for_team_repository(
- team_id, parsed.repository, source="signals_reviewers", priority=Priority.CRITICAL
+ team_id, parsed.repository, source="signals_reviewers", priority=Priority.NORMAL
)
except Exception:
logger.exception(
diff --git a/products/signals/backend/report_generation/ownership_reviewers.py b/products/signals/backend/report_generation/ownership_reviewers.py
index 722589bb53b7..d1036154182a 100644
--- a/products/signals/backend/report_generation/ownership_reviewers.py
+++ b/products/signals/backend/report_generation/ownership_reviewers.py
@@ -74,7 +74,7 @@ def suggest_repository_owners(
try:
team = Team.objects.get(id=team_id)
github = GitHubIntegration.first_for_team_repository(
- team_id, repository, source="signals_reviewers", priority=Priority.CRITICAL
+ team_id, repository, source="signals_reviewers", priority=Priority.BATCH
)
if github is None:
return []
diff --git a/products/signals/backend/report_generation/repo_activity.py b/products/signals/backend/report_generation/repo_activity.py
index 26078241fb27..8709d32415f0 100644
--- a/products/signals/backend/report_generation/repo_activity.py
+++ b/products/signals/backend/report_generation/repo_activity.py
@@ -236,17 +236,16 @@ def rebuild_repository_activity(team_id: int, repository: str) -> int:
def _commit_attributions_by_sha(team_id: int, repository: str) -> dict[str, GitHubCommitAttribution]:
"""GitHub's sha→login attribution for the activity window, keyed for the sha join."""
+ # Sheddable: rebuilds are deferrable background work — the egress limiter drops BATCH
+ # calls first when the installation's shared budget runs hot, and a denied listing
+ # aborts the rebuild rather than writing a half-attributed map.
github = GitHubIntegration.first_for_team_repository(
- team_id, repository, source="signals_activity_rebuild", priority=Priority.CRITICAL
+ team_id, repository, source="signals_activity_rebuild", priority=Priority.BATCH
)
if github is None:
# Same expected-deferral type the collector raises — the rebuild task logs it
# instead of capturing an exception.
raise RepositoryCommitActivityError(f"No GitHub integration for team {team_id} can access {repository}")
- # Sheddable: rebuilds are deferrable background work — the egress limiter drops BATCH
- # calls first when the installation's shared budget runs hot, and a denied listing
- # aborts the rebuild rather than writing a half-attributed map.
- github.priority = Priority.BATCH
since = timezone.now() - timedelta(days=ACTIVITY_WINDOW_DAYS)
return {attribution.sha: attribution for attribution in github.list_commit_attributions(repository, since=since)}
diff --git a/products/signals/backend/reviewer_pr_assignment.py b/products/signals/backend/reviewer_pr_assignment.py
index 54db22c1b531..28ddc7a650d2 100644
--- a/products/signals/backend/reviewer_pr_assignment.py
+++ b/products/signals/backend/reviewer_pr_assignment.py
@@ -245,7 +245,7 @@ def _github_for_repository(*, team_id: int, report_id: str, repository: str) ->
"""The team's GitHub integration for a repository, or None when there is none to call."""
try:
return GitHubIntegration.first_for_team_repository(
- team_id, repository, source="signals_reviewers", priority=Priority.CRITICAL
+ team_id, repository, source="signals_reviewers", priority=Priority.BATCH
)
except Exception:
logger.exception(
diff --git a/products/signals/backend/reviewer_pr_ready.py b/products/signals/backend/reviewer_pr_ready.py
index 9c7a52eea215..c6d59484756d 100644
--- a/products/signals/backend/reviewer_pr_ready.py
+++ b/products/signals/backend/reviewer_pr_ready.py
@@ -179,7 +179,7 @@ def open_pull_request_ready_for_review(*, team_id: int, report_id: str, pr_url:
try:
github = GitHubIntegration.first_for_team_repository(
- team_id, parsed.repository, source="signals_reviewers", priority=Priority.CRITICAL
+ team_id, parsed.repository, source="signals_reviewers", priority=Priority.BATCH
)
except Exception:
logger.exception(
diff --git a/products/signals/backend/supersession.py b/products/signals/backend/supersession.py
index f1259369b68e..05108d81beea 100644
--- a/products/signals/backend/supersession.py
+++ b/products/signals/backend/supersession.py
@@ -286,7 +286,7 @@ def _target_already_closed(team_id: int, target: ImplementationTarget) -> bool:
parsed = GitHubIntegrationBase.parse_pull_request_url(target.pr_url)
assert parsed is not None
github = GitHubIntegration.first_for_team_repository(
- team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.CRITICAL
+ team_id, parsed.repository, source="signals_implementation_pr", priority=Priority.BATCH
)
current = github.get_pull_request(parsed.repository, parsed.number) if github else {}
if not current.get("success"):
diff --git a/products/signals/backend/test/test_signal_report_assignment_api.py b/products/signals/backend/test/test_signal_report_assignment_api.py
index deb2458e8437..122920abebfe 100644
--- a/products/signals/backend/test/test_signal_report_assignment_api.py
+++ b/products/signals/backend/test/test_signal_report_assignment_api.py
@@ -455,7 +455,7 @@ class TestSignalReportAssignmentAPI(APIBaseTest):
assert response.status_code == status.HTTP_200_OK
mock_first_for_repository.assert_called_once_with(
- self.team.id, "PostHog/posthog", source="signals_reviewers", priority=Priority.CRITICAL
+ self.team.id, "PostHog/posthog", source="signals_reviewers", priority=Priority.NORMAL
)
github.get_pull_request.assert_called_once_with("PostHog/posthog", 123)
pr = SignalReportPullRequest.objects.for_team(self.team.id).get(repository="posthog/posthog", number=123)
@@ -556,7 +556,7 @@ class TestSignalReportAssignmentAPI(APIBaseTest):
assert response.status_code == status.HTTP_200_OK
mock_first_for_repository.assert_called_once_with(
- self.team.id, "PostHog/posthog", source="signals_reviewers", priority=Priority.CRITICAL
+ self.team.id, "PostHog/posthog", source="signals_reviewers", priority=Priority.NORMAL
)
pr = SignalReportPullRequest.objects.for_team(self.team.id).get(repository="posthog/posthog", number=123)
assert pr.repository == "posthog/posthog"
diff --git a/products/signals/backend/tracker_issues.py b/products/signals/backend/tracker_issues.py
index 4bd5e8f40791..2c2ef2c779cb 100644
--- a/products/signals/backend/tracker_issues.py
+++ b/products/signals/backend/tracker_issues.py
@@ -362,7 +362,7 @@ def _comment_before_close(tracker: SignalReportTrackerIssue, *, report_link: str
context = tracker.external_context or {}
try:
GitHubIntegration(
- tracker.integration, source="signals_tracker_issues", priority=Priority.CRITICAL
+ tracker.integration, source="signals_tracker_issues", priority=Priority.BATCH
).comment_on_issue(
context["repository"],
int(context["number"]),
diff --git a/products/skills/backend/api/community_skill_sync.py b/products/skills/backend/api/community_skill_sync.py
index 94fe6b8502ad..42ac665ac266 100644
--- a/products/skills/backend/api/community_skill_sync.py
+++ b/products/skills/backend/api/community_skill_sync.py
@@ -300,7 +300,7 @@ def sync_community_skills_from_github(registry_url: str = COMMUNITY_SKILLS_REGIS
source="community_skills",
installation_id=None,
timeout=COMMUNITY_SKILLS_SYNC_TIMEOUT_SECONDS,
- priority=Priority.CRITICAL,
+ priority=Priority.BATCH,
)
response.raise_for_status()
payload = response.json()
diff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.py
index a39795a926c2..f2445b619d06 100644
--- a/products/slack_app/backend/api.py
+++ b/products/slack_app/backend/api.py
@@ -1116,7 +1116,7 @@ def _get_full_repo_names(integration: Integration, *, user_id: int | None) -> li
all_repos: set[str] = set()
for record in user_records:
- github = UserGitHubIntegration(record, source="slack_app_repo_selection", priority=Priority.CRITICAL)
+ github = UserGitHubIntegration(record, source="slack_app_repo_selection", priority=Priority.NORMAL)
repo_entries = github.list_all_cached_repositories(max_repos=_MAX_GITHUB_REPOS)
for repo in repo_entries:
all_repos.add(repo["full_name"])
diff --git a/products/tasks/backend/logic/pull_request_titles.py b/products/tasks/backend/logic/pull_request_titles.py
index 29f62fb6f443..d3cbb102e7d1 100644
--- a/products/tasks/backend/logic/pull_request_titles.py
+++ b/products/tasks/backend/logic/pull_request_titles.py
@@ -58,13 +58,13 @@ def _integration_key(task: Task, user_id: int) -> tuple[str, int | str]:
def _github_for_task(task: Task, team_id: int, user_id: int) -> GitHubIntegration | UserGitHubIntegration | None:
user_integration = task.github_user_integration
if user_integration is not None and user_integration.user_id == user_id:
- return UserGitHubIntegration(user_integration, source="tasks", priority=Priority.CRITICAL)
+ return UserGitHubIntegration(user_integration, source="tasks", priority=Priority.NORMAL)
if not task.github_integration_id:
return None
integration = Integration.objects.filter(team_id=team_id, kind="github", id=task.github_integration_id).first()
if integration is None:
return None
- github = GitHubIntegration(integration, source="tasks", priority=Priority.CRITICAL)
+ github = GitHubIntegration(integration, source="tasks", priority=Priority.NORMAL)
if github.access_token_expired():
github.refresh_access_token()
return github
diff --git a/products/tasks/backend/logic/services/repo_commit_activity.py b/products/tasks/backend/logic/services/repo_commit_activity.py
index 4ac0de4b909b..ac01764d1c50 100644
--- a/products/tasks/backend/logic/services/repo_commit_activity.py
+++ b/products/tasks/backend/logic/services/repo_commit_activity.py
@@ -80,7 +80,7 @@ def collect_repository_commit_activity(
"""
repository = repository.strip().lower()
github = GitHubIntegration.first_for_team_repository(
- team_id, repository, source="repo_commit_activity", priority=Priority.CRITICAL
+ team_id, repository, source="repo_commit_activity", priority=Priority.BATCH
)
if github is None:
raise RepositoryCommitActivityError(f"No GitHub integration for team {team_id} can access {repository}")
diff --git a/products/tasks/backend/max_tools.py b/products/tasks/backend/max_tools.py
index 0d67ca2a9122..5d36cfc8e47d 100644
--- a/products/tasks/backend/max_tools.py
+++ b/products/tasks/backend/max_tools.py
@@ -561,7 +561,7 @@ Use this tool when the user wants to:
for integration in integrations:
try:
- github = GitHubIntegration(integration, source="tasks", priority=Priority.CRITICAL)
+ github = GitHubIntegration(integration, source="tasks", priority=Priority.NORMAL)
org = github.organization()
repos = github.list_all_cached_repositories()
diff --git a/products/visual_review/backend/logic/baselines.py b/products/visual_review/backend/logic/baselines.py
index 4d5403c0e02c..3911162120ea 100644
--- a/products/visual_review/backend/logic/baselines.py
+++ b/products/visual_review/backend/logic/baselines.py
@@ -362,7 +362,7 @@ def _get_coauthor_trailer(user_id: int, installation_id: str) -> str | None:
).first()
if user_integration is None:
return None
- return UserGitHubIntegration(user_integration, source="visual_review", priority=Priority.CRITICAL).coauthor_trailer
+ return UserGitHubIntegration(user_integration, source="visual_review", priority=Priority.NORMAL).coauthor_trailer
def _commit_baseline_to_github(
diff --git a/products/visual_review/backend/logic/comment_markdown.py b/products/visual_review/backend/logic/comment_markdown.py
index d8b7bd1dc36c..3d24e3c9cc55 100644
--- a/products/visual_review/backend/logic/comment_markdown.py
+++ b/products/visual_review/backend/logic/comment_markdown.py
@@ -278,7 +278,7 @@ def _resolve_approver(user_id: int | None) -> _Approver | None:
.first()
)
if gh is not None:
- github_login = UserGitHubIntegration(gh, source="visual_review", priority=Priority.CRITICAL).github_login
+ github_login = UserGitHubIntegration(gh, source="visual_review", priority=Priority.BATCH).github_login
if github_login:
return _Approver(label=github_login, is_github_login=True)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py
index ed0936893e06..eadeaf1f1441 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py
@@ -519,7 +519,7 @@ If automatic creation failed with a permissions error, the fix depends on how yo
integration = self.get_oauth_integration(config.auth_method.github_integration_id, team_id)
return GithubEgressIdentity(
installation_id=GitHubIntegration(
- integration, source="warehouse", priority=Priority.CRITICAL
+ integration, source="warehouse", priority=Priority.BATCH
).github_installation_id
)