Apify & CrawleeA&CApify & Crawlee
Powered by
conventional-blackC
Apify & Crawleeβ€’3y agoβ€’
12 replies
conventional-black

Workflow for manually reprocessing requests when using @apify/storage-local for SQLite Request Queue

Use case: I'm debugging a crawler. Majority of request handlers succeed, only few fail. I wanna fix/adjust the request handler logic; get from logs failed urls; open some SQLite editor; find those requests in request queue table and somehow mark them as unprocessed. Then rerun the crawler with
CRAWLEE_PURGE_ON_START=false
CRAWLEE_PURGE_ON_START=false
so it only run the previously problematic urls. Iterate few times to catch all bugs, and then run the whole crawler with purged storage.

After lot of debugging/investigating Crawlee & @Apify/storage-local I've managed to figure out a working workflow, but it's kinda laborious:
* set row's orderNo to some future date in ms from epoch
* edit rows' json and remove handledAt property [2]
* run the crawler, which will re-add handledAt property
* delete row's orderNo (not sure why that is not done automatically)

That's kinda tedious, do you know of some better way? Or is there some out-of-the-approach for my usecase without hacking SQLite? I've found out this approach recommended by one-and-only @Lukas Krivka here πŸ™‚ https://github.com/apify/crawlee/discussions/1232#discussioncomment-1625019

[1]
https://github.com/apify/apify-storage-local-js/blob/8dd40e88932097d2260f68f28412cc29ff894e0f/src/emulators/request_queue_emulator.ts#L341
[2]
https://github.com/apify/crawlee/blob/52b98e3e997680e352da5763b394750b19110953/packages/core/src/storages/request_queue.ts#L164
Screen_2024-01-03_at_21.06.08.png
GitHub
How can I mark requests in the queue as unprocessed? Β· apify crawle...
How can I make requests in the RequestQueueue queue available for re-processing? I am interested in how to do this both for the entire queue and for individual requests. Suppose the actor has proce...
How can I mark requests in the queue as unprocessed? Β· apify crawle...
GitHub
apify-storage-local-js/src/emulators/request_queue_emulator.ts at 8...
Local emulation of the apify-client NPM package, which enables local use of Apify SDK. - apify/apify-storage-local-js
apify-storage-local-js/src/emulators/request_queue_emulator.ts at 8...
GitHub
crawlee/packages/core/src/storages/request_queue.ts at 52b98e3e9976...
Crawleeβ€”A web scraping and browser automation library for Node.js that helps you build reliable crawlers. Fast. - apify/crawlee
crawlee/packages/core/src/storages/request_queue.ts at 52b98e3e9976...
Apify & Crawlee banner
Apify & CrawleeJoin
This is the official developer community of Apify and Crawlee.
14,091Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Recent Announcements
ellativity

**Update to Store Publishing Terms and Acceptable Use Policy** Due to an influx of fraudulent reviews recently, Apify's Legal team has taken some actions to protect developers, customers, and Apify, by updating the Store Publishing Terms and Acceptable Use Policy. Please pay special attention to the updated terms in section 4 of the Store Publishing Terms here: https://docs.apify.com/legal/store-publishing-terms-and-conditions Additionally, please review the changes to section 2 of the Acceptable Use Policy here: https://docs.apify.com/legal/acceptable-use-policy If you have any questions, please ask them in <#1206131794261315594> so everyone can see the discussion. Thanks!

ellativity Β· 3w ago

ellativity

Hi @everyone I'm hanging out with the Creator team at Apify in https://discord.com/channels/801163717915574323/1430491198145167371 if you want to discuss Analytics and Insights!

ellativity Β· 4w ago

ellativity

2 things for <@&1092713625141137429> members today: 1. The Apify developer rewards program is open for registrations: https://apify.notion.site/developer-rewards This is the program where you will earn points for marketing activities. The rewards are still TBC, but the real purpose of the program is to help you structure your marketing activities and efforts. In the coming weeks, I will be populating that link with guides to help you identify the best ways to market your Actors, as well as scheduling workshops and office hours to help you create content and develop your own marketing strategy. 2. At 2PM CET (in about 80 minutes) there will be an office hour with the team behind Insights and Analytics, who want your feedback on how to improve analytics for you. Join us in https://discord.com/channels/801163717915574323/1430491198145167371 to share your ideas!

ellativity Β· 4w ago

Similar Threads

disable request queue storage
skinny-azureSskinny-azure / crawlee-js
4y ago
Expire requests from request queue
scattered-tealSscattered-teal / crawlee-js
3y ago
Limit request queue
NeoNomadeNNeoNomade / crawlee-js
6mo ago
request queue data
verbal-limeVverbal-lime / crawlee-js
2y ago