@@ -596,7 +596,7 @@ export class PullRequestSyncService {
596596 const since = new Date ( ) ;
597597 since . setDate ( since . getDate ( ) - daysBack ) ;
598598
599- this . logger . log (
599+ console . log (
600600 `Starting PR backfill for user ${ userId } : ${ daysBack } days back (since ${ since . toISOString ( ) } )` ,
601601 ) ;
602602
@@ -618,7 +618,7 @@ export class PullRequestSyncService {
618618 } ,
619619 } ) ;
620620
621- this . logger . log (
621+ console . log (
622622 `Found ${ userRepositories . length } enabled repositories for user ${ userId } ` ,
623623 ) ;
624624
@@ -633,7 +633,7 @@ export class PullRequestSyncService {
633633 continue ;
634634 }
635635
636- this . logger . log (
636+ console . log (
637637 `[${ i + 1 } /${ userRepositories . length } ] Fetching PRs for ${ userRepo . fullName } (since ${ since . toISOString ( ) } )` ,
638638 ) ;
639639
@@ -645,11 +645,11 @@ export class PullRequestSyncService {
645645 state : 'all' ,
646646 since,
647647 accessToken,
648- maxPages : 5 , // Limit to 5 pages (500 PRs) per repo to avoid excessive API calls
648+ maxPages : 2 , // Limit to 2 pages (200 PRs) per repo for faster backfill
649649 } ,
650650 ) ;
651651
652- this . logger . log (
652+ console . log (
653653 `[${ i + 1 } /${ userRepositories . length } ] Found ${ pullRequests . length } PRs for ${ userRepo . fullName } ` ,
654654 ) ;
655655
@@ -683,46 +683,42 @@ export class PullRequestSyncService {
683683 await this . syncLabels ( githubId , pr as any ) ;
684684 await this . syncAssignees ( githubId , pr as any ) ;
685685
686- // Sync checks if we have an access token
687- if ( accessToken ) {
688- await this . syncChecksFromAPI (
689- owner ,
690- repo ,
691- pr . number ,
692- githubId ,
693- accessToken ,
694- ) ;
695- }
686+ // Skip checks during backfill for performance
687+ // Checks will be synced via webhooks for active PRs
688+ // Note: If you want checks, only sync for open PRs:
689+ // if (accessToken && pr.state === 'open') {
690+ // await this.syncChecksFromAPI(owner, repo, pr.number, githubId, accessToken);
691+ // }
696692
697693 result . pullRequestsProcessed ++ ;
698694
699695 // Log progress every 10 PRs or on the last PR
700696 if ( ( prIndex + 1 ) % 10 === 0 || prIndex === pullRequests . length - 1 ) {
701- this . logger . log (
697+ console . log (
702698 ` Progress: ${ prIndex + 1 } /${ pullRequests . length } PRs synced for ${ userRepo . fullName } ` ,
703699 ) ;
704700 }
705701 } catch ( prError ) {
706702 const errorMsg = `Error syncing PR #${ pr . number } in ${ userRepo . fullName } : ${ prError instanceof Error ? prError . message : String ( prError ) } ` ;
707- this . logger . error ( errorMsg ) ;
703+ console . error ( errorMsg ) ;
708704 result . errors . push ( errorMsg ) ;
709705 }
710706 }
711707
712708 result . repositories ++ ;
713- this . logger . log (
709+ console . log (
714710 `[${ i + 1 } /${ userRepositories . length } ] Completed ${ userRepo . fullName } : ${ pullRequests . length } PRs synced` ,
715711 ) ;
716712 } catch ( repoError ) {
717713 const errorMsg = `Error processing repository ${ userRepo . fullName } : ${ repoError instanceof Error ? repoError . message : String ( repoError ) } ` ;
718- this . logger . error ( errorMsg ) ;
714+ console . error ( errorMsg ) ;
719715 result . errors . push ( errorMsg ) ;
720716 // Continue with next repository
721717 }
722718 }
723719
724720 const duration = ( ( Date . now ( ) - startTime ) / 1000 ) . toFixed ( 2 ) ;
725- this . logger . log (
721+ console . log (
726722 `Completed PR backfill for user ${ userId } in ${ duration } s: ` +
727723 `${ result . repositories } repos, ${ result . pullRequestsProcessed } PRs ` +
728724 `(${ result . pullRequestsCreated } created, ${ result . pullRequestsUpdated } updated), ` +
@@ -732,7 +728,7 @@ export class PullRequestSyncService {
732728 return result ;
733729 } catch ( error ) {
734730 const errorMsg = `Fatal error in PR backfill for user ${ userId } : ${ error instanceof Error ? error . message : String ( error ) } ` ;
735- this . logger . error ( errorMsg ) ;
731+ console . error ( errorMsg ) ;
736732 result . errors . push ( errorMsg ) ;
737733 throw error ;
738734 }
0 commit comments