redis.expireTime() returns relative TTL seconds on live host instead of Unix timestamp seconds
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 78/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- redis, typescript
研究方向
首先追蹤 redis.expireTime() 的即時主機實作,並將其與 @devvit/test 中的 redis.d.ts 和 RedisMock 進行比較。驗證即時路徑是否錯誤地將 ExpireTime 對應至 TTL,然後針對 mock 新增或更新絕對 Unix 過期時間戳的測試涵蓋範圍。當即時版本與 mock 版本的 redis.expireTime() 回傳相同的絕對時間戳語意,而且重現案例不再回傳 60 或 59 時,工作即告完成。
由索引模型根據 Issue 內容生成。
描述
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).
- 主要語言
- TypeScript
- 星號
- 217
- 分支
- 89
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
reddit/devvit 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 85/100
-
難度 2/5 1-3 小時 新手友好度 67/100
-
Bound concurrent filesystem reads during asset discovery and source ZIP generation可能已有人在做 @CR29-22-2805 於 138 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 72/100
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 95/100
amosblomqvist/learnharness#1141 ·
維護者通常 4 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
ranxianglei/billion-context#8319 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
tencent-connect/dsh-qqbot#148 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
JimLiu/open-artifact#126 ·
-
bug repro-ready
難度 2/5 1-3 小時 新手友好度 86/100
mksglu/context-mode#1454 ·