devvit icon indicating copy to clipboard operation
devvit copied to clipboard

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

Open devvit-help-bot[bot] opened this issue 1 year ago • 1 comments

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

devvit-help-bot[bot] avatar Nov 08 '24 15:11 devvit-help-bot[bot]

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

fsvreddit avatar Nov 08 '24 17:11 fsvreddit