Repository navigation
feat: Add skipRequest context helper - #4158
Conversation
B4nan
left a comment
There was a problem hiding this comment.
few things found from staff review, I'd address the first one at least
barjin
left a comment
There was a problem hiding this comment.
Thank you @janbuchar !
I agree with Martin's notes above, otherwise lgtm 👍
1d23f6e to
274dff9
Compare
7313f85 to
05ec98b
Compare
274dff9 to
47bb349
Compare
barjin
left a comment
There was a problem hiding this comment.
Thank you @janbuchar , few more questions, but otherwise lgtm.
Once these are resolved (or considered wontfix), it's good to go by me 👍
…r error handler call and restore a timeoutAndRetry call
barjin
left a comment
There was a problem hiding this comment.
thank you @janbuchar , just one last edge case ⬇️
Once that's dealt with, let's merge ![]()
| // retry is counted, so that an error handler that always times out does not retry it forever. | ||
| this.log.warning(unwrappedSecondaryError.message); | ||
| if (!skipped && request.retryCount === retryCountBefore) { | ||
| if (!(err instanceof ContextPipelineInterruptedError) && request.retryCount === retryCountBefore) { |
There was a problem hiding this comment.
When onSkippedRequest times out, err here is still the ContextPipelineInterruptedError, right? Does it mean this ⬇️ will keep looping?
import { BasicCrawler, Configuration, serviceLocator } from '@crawlee/basic';
import { setTimeout } from 'node:timers/promises';
serviceLocator.setConfiguration(new Configuration({ internalTimeoutMillis: 100 }));
const crawler = new BasicCrawler({
requestHandlerTimeoutSecs: 0.05,
requestHandler: async ({ skipRequest }) => skipRequest(),
onSkippedRequest: () => setTimeout(300),
});
await crawler.run(['https://example.com']);Something like:
onSkippedRequesttimeouts- we do not increment the counter because of the change here
- we process the request again, skip it again
- back to step one - infinite loop?
Maybe a timed-out onSkippedRequest should go the same way as a throwing one, i.e. become an ordinary failure that uses up the retry budget?
ContextPipelineInterruptedErrorbefore 4.0 #4141