redis.expireTime() returns relative TTL seconds on live host instead of Unix timestamp seconds
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- redis, typescript
Research direction
Start by tracing the live host implementation of redis.expireTime() and compare it with redis.d.ts and RedisMock in @devvit/test. Verify whether the live path incorrectly maps ExpireTime to TTL, then add or update coverage for absolute Unix expiration timestamps against the mock. The work is done when live and mocked redis.expireTime() return the same absolute timestamp semantics and the repro no longer returns 60 or 59.
Written by the indexing model from the issue text.
Description
In @devvit/redis (0.15.6), redis.expireTime(key) behaves differently between the live Devvit runtime and both its TypeScript documentation and RedisMock.
Expected (per redis.d.ts and standard Redis EXPIRETIME):
The JSDoc states:
Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.
RedisMock in @devvit/test follows this and returns an absolute Unix timestamp in seconds (e.g. 1796474880).
Actual on live Devvit (0.15.6):
Calling redis.expireTime(key) right after redis.expire(key, 60) returns the remaining relative TTL in seconds (60, then 59 on a follow-up read) instead of a Unix timestamp.
Minimal repro:
await redis.set('probe:ttl', '1');
await redis.expire('probe:ttl', 60);
const exp = await redis.expireTime('probe:ttl');
console.log({ exp, nowSec: Math.floor(Date.now() / 1000) });
// RedisMock (@devvit/test): exp is ~nowSec + 60 (Unix timestamp)
// Live Devvit 0.15.6 host: exp is 60 (or 59) — relative TTL seconds
Why this bites in practice:
Any code comparing expireTime(key) against Date.now() / 1000 (e.g. checking whether a lock or daily state key is about to roll over) passes under @devvit/test and then reads 60 < 1796... as already expired in production. It looks like the host plugin is wiring ExpireTime to TTL rather than EXPIRETIME (or the JSDoc and RedisMock need to match if relative TTL is intentional).
- Dominant language
- TypeScript
- Stars
- 217
- Forks
- 89
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reddit/devvit
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Bound concurrent filesystem reads during asset discovery and source ZIP generationPossibly taken @CR29-22-2805 claimed this 138 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
amosblomqvist/learnharness#1141 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ranxianglei/billion-context#8319 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
tencent-connect/dsh-qqbot#148 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JimLiu/open-artifact#126 ·
-
bug repro-ready
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
mksglu/context-mode#1454 ·