summary refs log tree commit diff
path: root/lib/githubexplorer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/githubexplorer')
-rw-r--r--lib/githubexplorer/Profile.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/githubexplorer/Profile.pm b/lib/githubexplorer/Profile.pm
index 7966d79..1f38452 100644
--- a/lib/githubexplorer/Profile.pm
+++ b/lib/githubexplorer/Profile.pm
@@ -10,10 +10,12 @@ sub fetch_profile {
     my ( $self, $login, $depth ) = @_;
 
     return if grep {$_ =~ /$login/i} @{$self->banned_profiles};
-
     return if $depth > 2;
+
     my $profile = $self->_profile_exists($login);
 
+    return $profile if $profile;
+
     say "fetch profile for $login ($depth)...";
     my $github = Net::GitHub::V2::Users->new(
         owner => $login,
@@ -25,9 +27,9 @@ sub fetch_profile {
     if ( !$profile ) {
         $profile = $self->_create_profile( $login, $github->show, $depth );
         sleep(1);
-    }
-    if ( $self->with_repo ) {
-        $self->fetch_repositories( $profile, $github->list );
+        if ( $self->with_repo ) {
+            $self->fetch_repositories( $profile, $github->list );
+        }
     }
 
     my $followers   = $github->followers();