Skip to content

Commit 01d189a

Browse files
committed
docs: document the RequestQueueClient v4 migration
Expand the `RequestQueueClient` migration table in the v4 upgrading guide with the full method mapping, the new fetch/handle/reclaim lifecycle, the `isEmpty` semantics, and the `RequestQueueV1`-as-alias note. List the removed head/lock types. Closes #3075.
1 parent 12b04d2 commit 01d189a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

docs/upgrading/upgrading_v4.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,28 @@ The sub-client interfaces (`DatasetClient`, `KeyValueStoreClient`, `RequestQueue
560560

561561
**`RequestQueueClient`:**
562562

563+
The request queue client was reduced from 12 methods to 9. The distributed-locking protocol (`listAndLockHead``prolongRequestLock``deleteRequestLock`) and the queue-head/consistency bookkeeping that used to live in the `RequestQueue` frontend have been removed from the interface; coordinating multiple clients accessing the same queue (e.g. request locking on the Apify platform) is now an internal concern of the client implementation.
564+
563565
| Before (v3) | After (v4) |
564566
|---|---|
567+
| `addRequest(request, opts?)` | `addBatchOfRequests([request], opts?)` |
568+
| `batchAddRequests(requests, opts?)` | `addBatchOfRequests(requests, opts?)` |
569+
| `getRequest(id)` | `getRequest(uniqueKey)` |
570+
| `updateRequest(request, opts?)` | `markRequestAsHandled(request)` / `reclaimRequest(request, opts?)` |
571+
| `listHead(opts?)` | `fetchNextRequest()` (returns a single request, marks it in progress) |
572+
| `listAndLockHead(opts)` | Removed (locking is internal to the client) |
573+
| `prolongRequestLock(id, opts)` | Removed |
574+
| `deleteRequestLock(id, opts?)` | Removed |
565575
| `deleteRequest(id)` | Removed |
576+
| _(n/a)_ | `isEmpty()` (new — `true` when no pending requests remain) |
577+
578+
The lifecycle is now: `fetchNextRequest()` hands out a pending request and marks it in progress; once processed, call `markRequestAsHandled(request)`; on failure call `reclaimRequest(request, { forefront? })` to return it to the queue.
579+
580+
`RequestQueueClient.isEmpty()` reports whether any **pending** request remains (i.e. whether the next `fetchNextRequest()` would return `null`); requests that are in progress are not counted.
581+
582+
`RequestQueueV1` and `RequestQueueV2` no longer differ in behavior — both are thin frontends over the slim client — and `RequestQueueV1` is now a deprecated alias of `RequestQueue`.
566583

567-
**Removed types** from `@crawlee/types`: `DatasetClientUpdateOptions`, `KeyValueStoreClientUpdateOptions`, `KeyValueStoreRecordOptions`, `KeyValueStoreClientListData`, `KeyValueStoreClientGetRecordOptions`. `KeyValueStoreClientListOptions` was renamed to `KeyValueStoreListKeysOptions`.
584+
**Removed types** from `@crawlee/types`: `DatasetClientUpdateOptions`, `KeyValueStoreClientUpdateOptions`, `KeyValueStoreRecordOptions`, `KeyValueStoreClientListData`, `KeyValueStoreClientGetRecordOptions`, `QueueHead`, `RequestQueueHeadItem`, `ListOptions`, `ListAndLockOptions`, `ListAndLockHeadResult`, `ProlongRequestLockOptions`, `ProlongRequestLockResult`, `DeleteRequestLockOptions`. `KeyValueStoreClientListOptions` was renamed to `KeyValueStoreListKeysOptions`.
568585

569586
The high-level storage classes (`Dataset`, `KeyValueStore`, `RequestQueue`) now receive their sub-client directly in the constructor options instead of receiving a `StorageClient` and calling its methods.
570587

0 commit comments

Comments
 (0)