åºç¤¾ãã¦ããã¦åå¤ããæºã£ã feed ãèªããããªã㨠Plagger ãèµ°ããã¦ã
æªèª entry ã 500 ã»ã©æºã£ãç¶æ
ã§
Can't use string ("500 Server closed connection wit") as a HASH ref while "strict refs" in use at /home/fujiwara/devel/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm line 80.
ã³ã±ããLDR ã®ãµã¼ããã¨ã©ã¼ãè¿ããã®ã«ãããããã¼ã¿ã¨ãã¦å¦çãããã¨ããããã(ãªãã¡ã¬ã³ã¹ã§ãªãã®ãããªãã¡ã¬ã³ã¹ãããã¨ãã)
feed ã entry ãèªã¿è¾¼ãã§ã¡ã¢ãªä¸ã«ä¹ã£ãã£ãç¶æ 㧠(ããã LDR å´ã¯æ¢èªã«ãã¡ãã£ãå¾)ãStore ã Publish ãããåã«è½ã¡ãã¨ãæªèªãå ¨é¨ã¡ã¢ãªã®é²ã¨æ¶ãããæ²ããããã
DB ã¿ããã«ãã©ã³ã¶ã¯ã·ã§ã³å¦çãã¨ããã®ãé£ããããããã¦å°ãã§ã被害ãé²ã patch.
diff ã®é½åã§ãããã¨é·ããã©ãè¦ã¯
my $feed = Plagger::Feed->new;
ãã
$context->update->add($feed);
ã¾ã§ã eval ã§æ¬ã£ã¦ä¾å¤ãææãæ¢èªã«ããå¦ç ( touch_all ) ã¯ãããã¾ã§ã®å¦çãæ£å¸¸ã«å®äºãã¦ããè¡ãããã«ããã
Index: Subscription/LivedoorReader.pm =================================================================== --- Subscription/LivedoorReader.pm (revision 1018) +++ Subscription/LivedoorReader.pm (working copy) @@ -72,39 +72,43 @@ for my $sub (@$subs) { $context->log(debug => "get unread items of $sub->{subscribe_id}"); my $data = $self->_request("/api/unread", { subscribe_id => $sub->{subscribe_id} }); - $self->_request("/api/touch_all", { subscribe_id => $sub->{subscribe_id} }) - if $mark_read; + eval { + my $feed = Plagger::Feed->new; + $feed->type('livedoorReader'); + $feed->title( Plagger::Util::strip_html($data->{channel}->{title}) ); + $feed->link($data->{channel}->{link}); + $feed->url($data->{channel}->{feedlink}); + $feed->image({ url => $data->{channel}->{image} || $sub->{icon} }); + $feed->meta->{livedoor_reader_id} = $sub->{subscribe_id}; + $feed->meta->{rate} = $sub->{rate}; + $feed->add_tag($_) for @{$sub->{tags}}; + $feed->add_tag($sub->{folder}) if $sub->{folder}; + $feed->updated( Plagger::Date->from_epoch($sub->{modified_on}) ) if $sub->{modified_on}; + $feed->description($data->{channel}->{description}); + $feed->meta->{livedoor_reader_subscribers_count} = $data->{channel}->{subscribers_count}; - my $feed = Plagger::Feed->new; - $feed->type('livedoorReader'); - $feed->title( Plagger::Util::strip_html($data->{channel}->{title}) ); - $feed->link($data->{channel}->{link}); - $feed->url($data->{channel}->{feedlink}); - $feed->image({ url => $data->{channel}->{image} || $sub->{icon} }); - $feed->meta->{livedoor_reader_id} = $sub->{subscribe_id}; - $feed->meta->{rate} = $sub->{rate}; - $feed->add_tag($_) for @{$sub->{tags}}; - $feed->add_tag($sub->{folder}) if $sub->{folder}; - $feed->updated( Plagger::Date->from_epoch($sub->{modified_on}) ) if $sub->{modified_on}; - $feed->description($data->{channel}->{description}); - $feed->meta->{livedoor_reader_subscribers_count} = $data->{channel}->{subscribers_count}; + for my $item ( @{$data->{items}} ) { + my $entry = Plagger::Entry->new; + $entry->title($item->{title}); + $entry->author($item->{author}) if $item->{author}; + $entry->link($item->{link}); + # TODO support enclosure + $entry->tags([ $item->{category} ]) if $item->{category}; + $entry->date( Plagger::Date->from_epoch($item->{modified_on}) ); # xxx created_on as well + $entry->meta->{livedoor_reader_item_id} = $item->{id}; + $entry->feed_link($feed->link); + $entry->body($item->{body}); - for my $item ( @{$data->{items}} ) { - my $entry = Plagger::Entry->new; - $entry->title($item->{title}); - $entry->author($item->{author}) if $item->{author}; - $entry->link($item->{link}); - # TODO support enclosure - $entry->tags([ $item->{category} ]) if $item->{category}; - $entry->date( Plagger::Date->from_epoch($item->{modified_on}) ); # xxx created_on as well - $entry->meta->{livedoor_reader_item_id} = $item->{id}; - $entry->feed_link($feed->link); - $entry->body($item->{body}); - - $feed->add_entry($entry); + $feed->add_entry($entry); + } + $context->update->add($feed); + }; + if($@){ + $context->log(error => $@); + next; } - - $context->update->add($feed); + $self->_request("/api/touch_all", { subscribe_id => $sub->{subscribe_id} }) + if $mark_read; } }