Skip to content

Commit

Permalink
make yield amount a param (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-codecov committed May 13, 2024
1 parent 4c28604 commit 966d2e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions tasks/backfill_existing_gh_app_installations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@

log = logging.getLogger(__name__)

YIELD_AMOUNT = 100


class BackfillExistingGHAppInstallationsTask(
BaseCodecovTask, name=backfill_existing_gh_app_installations_name
):
def backfill_existing_gh_apps(
self, db_session: Session, owner_ids: List[int] = None, missed_owner_ids=[]
self,
db_session: Session,
owner_ids: List[int] = None,
missed_owner_ids=[],
yield_amount: int = 1000,
):
# Get owners that have installations, and installations queries
owners_query = (
Expand All @@ -42,7 +44,7 @@ def backfill_existing_gh_apps(
)

gh_app_installations: List[GithubAppInstallation] = (
gh_app_installations_query.yield_per(YIELD_AMOUNT)
gh_app_installations_query.yield_per(yield_amount)
)

for gh_app_installation in gh_app_installations:
Expand Down
10 changes: 6 additions & 4 deletions tasks/backfill_owners_without_gh_app_installations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@

log = logging.getLogger(__name__)

YIELD_AMOUNT = 100


class BackfillOwnersWithoutGHAppInstallations(
BaseCodecovTask, name=backfill_owners_without_gh_app_installations_name
):
def backfill_owners_with_integration_without_gh_app(
self, db_session: Session, owner_ids: List[int] = None, missed_owner_ids=[]
self,
db_session: Session,
owner_ids: List[int] = None,
missed_owner_ids=[],
yield_amount: int = 1000,
):
owners_with_integration_id_without_gh_app_query = (
db_session.query(Owner)
Expand All @@ -50,7 +52,7 @@ def backfill_owners_with_integration_without_gh_app(
)

owners: List[Owner] = owners_with_integration_id_without_gh_app_query.yield_per(
YIELD_AMOUNT
yield_amount
)

for owner in owners:
Expand Down

0 comments on commit 966d2e8

Please sign in to comment.