Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forefront option throughout requestQueue client in memory storage does not work #1787

Closed
1 task
jirimoravcik opened this issue Feb 13, 2023 · 0 comments · Fixed by #1816
Closed
1 task
Assignees
Labels
bug Something isn't working.

Comments

@jirimoravcik
Copy link
Member

Which package is this bug report for? If unsure which one to select, leave blank

@crawlee/memory-storage

Issue description

See repro code. Basically, the forefront parameter does not work, i.e. listHead just ignores the orderNo...

Code sample

import { MemoryStorage } from '@crawlee/memory-storage';

const ms = new MemoryStorage();
const rqInfo = await ms.requestQueues().getOrCreate('default');
const rq = ms.requestQueue(rqInfo.id);
await rq.addRequest({
    url: 'https://example.com',
    uniqueKey: 'https://example.com'
}, { forefront: false });
await rq.addRequest({
    url: 'https://example.com/1',
    uniqueKey: 'https://example.com/1'
}, { forefront: true });
await rq.addRequest({
    url: 'https://example.com/2',
    uniqueKey: 'https://example.com/2'
}, { forefront: false });

const head = await rq.listHead();
console.log(head);

Package version

3.2.2

Node.js version

16

Operating system

No response

Apify platform

  • Tick me if you encountered this issue on the Apify platform

I have tested this on the next release

No response

Other context

No response

@jirimoravcik jirimoravcik added the bug Something isn't working. label Feb 13, 2023
B4nan pushed a commit that referenced this issue Mar 7, 2023
Requests are now sorted by their `orderNo` when `listHead` is called,
ensuring forefront is actually respected

Closes #1787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants