reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
70 stars 17 forks source link

zRange: a limit of 1000 applied to zRange calls where { by: "score" } is specified #110

Open devvit-help-bot[bot] opened 5 days ago

devvit-help-bot[bot] commented 5 days ago

Details

there's a limit of 1000 applied to zRange calls where { by: "score" } is specified, but that doesn't apply more generally.

Example code from an app where I know that the sorted set has over 11,000 records in range:

    const resultsByScore = await context.redis.zRange(CLEANUP_KEY, 0, addDays(new Date(), 28).getTime(), { by: "score" });
    console.log(resultsByScore.length);

But the console output returns exactly 1000.

It's not causing me any issues but it should probably be documented if intentional, or changed if not.

Additional info

Discord message: _Another quirk, this time with zRange. I think that there's a limit of 1000 applied to zRange calls where { by: "score" } is specified, but that doesn't apply more generally.

Example code from an app where I know that the sorted set has over 11,000 records in range:

    const resultsByScore = await context.redis.zRange(CLEANUP_KEY, 0, addDays(new Date(), 28).getTime(), { by: "score" });
    console.log(resultsByScore.length);

But the console output returns exactly 1000.

It's not causing me any issues but it should probably be documented if intentional, or changed if not._

Message author: fsv

Discord link: https://discord.com/channels/1050224141732687912/1242689538447507458/1290257208990498850

fsvreddit commented 5 days ago

For what it's worth, I think this applies to all uses of zRange. I need to test this further though