Skip to content

Commit

Permalink
feat(request-queue): Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
drobnikj committed Dec 9, 2024
1 parent 540a8a6 commit 983ad20
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sources/platform/storage/request_queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ const requestQueueClient = client.requestQueue(requestQueue.id, {
// Get all requests from the queue and check one locked by the first Actor.
const requests = await requestQueueClient.listRequests();
const requestsLockedByAnotherRun = requests.items.filter((request) => request.lockByClient === 'requestqueueone');
const requestLockedByAnotherRun = await requestQueueClient.getRequest(
const requestLockedByAnotherRunDetail = await requestQueueClient.getRequest(
requestsLockedByAnotherRun[0].id,
);
Expand All @@ -527,16 +527,16 @@ const processingRequestsClientTwo = await requestQueueClient.listAndLockHead(
},
);
const wasBothRunsLockedSameRequest = !!processingRequestsClientTwo.items.find(
(request) => request.id === requestLockedByAnotherRun.id,
(request) => request.id === requestLockedByAnotherRunDetail.id,
);
console.log(`Was the request locked by the first run locked by the second run? ${wasBothRunsLockedSameRequest}`);
console.log(`Request locked until ${requestLockedByAnotherRun?.lockExpiresAt}`);
console.log(`Request locked until ${requestLockedByAnotherRunDetail?.lockExpiresAt}`);
// Other clients cannot modify the lock; attempting to do so will throw an error.
try {
await requestQueueClient.prolongRequestLock(
requestLockedByAnotherRun.id,
requestLockedByAnotherRunDetail.id,
{ lockSecs: 60 },
);
} catch (err) {
Expand Down

0 comments on commit 983ad20

Please sign in to comment.