Commit dd03c4d
feat: Add deduplication to
### Description
- Ensure that already known requests are excluded from
`api_client.batch_add_requests` calls to avoid expensive and pointless
API calls.
- Add all new requests to the cache when calling `batch_add_requests`.
- Add test with real API usage measurement.
### Issues
- Closes: #514
### Testing
- Added new integration tests to verify reduced API usage.
- Comparing benchmark actor based on master vs this PR. Actor is a
simple ParselCrawler that crawls the whole crawlee.dev, which contains
many duplicate links, as the documentation is cross-linked thoroughly.
Results:
- Massive reduction of cost from request queue.
- Significant overall speed up due to reduced API calls.
---------
Co-authored-by: Vlada Dusek <[email protected]>add_batch_of_requests (#534)1 parent 52777a7 commit dd03c4d
File tree
3 files changed
+314
-53
lines changed- src/apify/storage_clients/_apify
- tests/integration
3 files changed
+314
-53
lines changedLines changed: 67 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
250 | 307 | | |
251 | | - | |
252 | | - | |
253 | 308 | | |
254 | | - | |
255 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
256 | 314 | | |
257 | 315 | | |
258 | | - | |
259 | 316 | | |
260 | 317 | | |
261 | 318 | | |
| |||
0 commit comments