summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-01-30 15:20:49 +0100
committerfranck cuny <franck@lumberjaph.net>2010-01-30 15:20:49 +0100
commite86042cb712bb741d92770bdf4d131ea100a1bd4 (patch)
tree5542c3bbd4fd824afb82e07d80a0e5526dbe0fc3 /lib
parentdon't make a call for each repo, don't ask for lang, add fork to repo schema (diff)
downloadgithub-explorer-e86042cb712bb741d92770bdf4d131ea100a1bd4.tar.gz
don't fetch info if profile exists
Diffstat (limited to 'lib')
-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();