Comments (6)
I'm more prone to let the client to handle page download failures rather than apply a re-enqueue strategy blindly
A built in naive failure retry strategy for temporary network failures is already in place (https://github.com/taganaka/polipus/blob/master/lib/polipus/http.rb#L170-L179)
A client can easily implement its own error handling workflow for more fine grain control:
polipus.on_page_downloaded do |page|
add_to_queue page if page.error
end
I can add a new block handler like on_page_error {|page|...}
so that the error handling logic can be encapsulated there
on_page_downloaded
blocks is always called, no matter what.
Introducing on_page_error
handler should then skip on_page_downloaded
call since the page has not been downloaded
from polipus.
I think Page#storable?
should return false if there was an error.
Drawback is that this would hinder us to investigate an error
Advantage would be that if we queue the url again, it would skip the url later
I like on_page_error
as this would encapsulate the error handling on one place.
And one of the examples should show
polipus.on_page_error do |page|
polipus.add_to_queue(page) if page.error
end
from polipus.
I was wrong. The drawback mentioned does not exist, as we do not store the error message in the database.
from polipus.
storing the page with the error associated into the DB could be useful for better offline debug.
Having on_page_error
blocks executed before[1] page.storable?
is evaluated, users could easily modify the flow:
polipus.on_page_error do |page|
page.storable = false
polipus.add_to_queue(page)
end
However to store the error message into the DB, error attribute needs to be serialized and exposed into page.to_hash
method
[1]https://github.com/taganaka/polipus/blob/on_page_error/lib/polipus.rb#L207
from polipus.
implemented here: #29
from polipus.
Addressed into v 0.3.0
https://github.com/taganaka/polipus/releases/tag/0.3.0
from polipus.
Related Issues (20)
- #queue_overflow_adapter and #overflow_adapter; Same thing? HOT 1
- Robots.txt option HOT 3
- Change logging format HOT 1
- Show code coverage and results of quality analysis
- Gzip decoded body not used anywhere HOT 1
- Fails when response["Set-Cookie"] is nil HOT 3
- invalid byte sequence in US-ASCII (ArgumentError)
- Whitelist start urls? HOT 1
- Kill s3 entirely, use Fog, yo!
- Cannot install on JRuby 1.7.13. Error with bson_ext-1.9.2 HOT 9
- SocketError could mean, domain is gone or no internet connection
- Cannot use with mongoid ~> 4.0.0 HOT 5
- RethinkDB Storage HOT 2
- Anchor links converted to %23 causing 404 errors
- Support for other charsets than UTF-8 HOT 1
- [Question] Using MongoDB as 'cache' aside of Redis
- Support for headless crawling
- Make it work with Mongo 2.x HOT 2
- Unicode pages does not work anymore on 0.5.0 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polipus.