summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-02-09 14:29:58 +0100
committerfranck cuny <franck@lumberjaph.net>2010-02-09 14:29:58 +0100
commitf3c40d610bfd4f3cccb1e1269effe5ba76c4cafe (patch)
treea0bfeaa9be12000b774177c88c226db77fdf7a35
parentMerge branch 'master' of lj:github-explorer (diff)
downloadgithub-explorer-f3c40d610bfd4f3cccb1e1269effe5ba76c4cafe.tar.gz
check error
-rw-r--r--lib/githubexplorer/Repository.pm29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/githubexplorer/Repository.pm b/lib/githubexplorer/Repository.pm
index 7a402dd..664d727 100644
--- a/lib/githubexplorer/Repository.pm
+++ b/lib/githubexplorer/Repository.pm
@@ -15,6 +15,11 @@ sub fetch_repositories {
my $repo_list = $github_profile->list();
+ while ( ref $repo_list ne 'ARRAYREF' ) {
+ sleep(60);
+ $repo_list = $github_profile->list();
+ }
+
foreach my $repos (@$repo_list) {
next if $self->_repo_exists( $profile, $repos->{name} );
say "-> check " . $profile->login . "'s " . $repos->{name};
@@ -23,7 +28,8 @@ sub fetch_repositories {
next;
}
my $repo_rs;
- unless ( $repo_rs = $self->_repo_exists( $profile, $repos->{name} ) ) {
+ unless ( $repo_rs = $self->_repo_exists( $profile, $repos->{name} ) )
+ {
$repo_rs = $self->_create_repo( $profile, $repos );
say "== repository " . $repos->{name} . " created";
}
@@ -35,15 +41,22 @@ sub fetch_repositories {
token => $self->api_token,
);
my $langs = $api_repos->languages;
+ while ( ref $langs ne 'HASHREF' ) {
+ sleep(60);
+ $langs = $api_repos->languages;
+ }
+
foreach my $lang ( keys %$langs ) {
my $lang_rs = $self->_lang_exists($lang);
- $self->schema->resultset('RepoLang')->create(
- {
- repository => $repo_rs->id,
- language => $lang_rs->name,
- size => $langs->{$lang},
- }
- );
+ try {
+ $self->schema->resultset('RepoLang')->create(
+ {
+ repository => $repo_rs->id,
+ language => $lang_rs->name,
+ size => $langs->{$lang},
+ }
+ );
+ };
}
sleep(1);
}