Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

catch errors with the initial non-existent SORT for polling

  • Loading branch information...
commit 5e0733df4dc8d5e0df9f17d5a6a948a08299959f 1 parent 1228b0d
@miyagawa authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 lib/Subfeedr/Worker.pm
View
15 lib/Subfeedr/Worker.pm
@@ -20,11 +20,16 @@ sub start {
my $t; $t = AE::timer 0, 15, sub {
scalar $t;
my $ds = Subfeedr::DataStore->new('known_feed');
- $ds->sort('set', by => 'next_fetch.*', get => 'feed.*', limit => "0 20", sub {
- my $feeds = shift;
- for my $feed (map JSON::decode_json($_), @$feeds) {
- next if $feed->{next_fetch} && $feed->{next_fetch} > time;
- $self->work_url($feed->{url});
+ my $cv = $ds->sort('set', by => 'next_fetch.*', get => 'feed.*', limit => "0 20");
+ $cv->cb(sub {
+ # Use cv to catch errors ERR: no such key exist
+ my $cv = shift;
+ try {
+ my $feeds = shift;
+ for my $feed (map JSON::decode_json($_), @$feeds) {
+ next if $feed->{next_fetch} && $feed->{next_fetch} > time;
+ $self->work_url($feed->{url});
+ }
}
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.