graphql-hive / graphql-hive/envelop

Redis cache set ttl in ms instead of seconds

Open
#2,539 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
827
Forks
132
PR merge metrics
No merged PRs in 30d

Description

### Issue workflow progress

_Progress of the issue based on the
[Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_

- [-] 1. The issue provides a
[minimal reproduction](https://en.wikipedia.org/wiki/Minimal_reproducible_example) available on
[Stackblitz](https://stackblitz.com/fork/node).
- _Please install the latest `@envelop/*` packages that you are using._
- _Please make sure the reproduction is as small as possible._
- [-] 2. A failing test has been provided
- [x] 3. A local solution has been provided
- [-] 4. A pull request is pending review

---

**Describe the bug**

The code in response-cache-redis is

```ts
if (ttl === Infinity) {
pipeline.set(responseId, JSON.stringify(result));
} else {
// set the ttl in milliseconds
pipeline.set(responseId, JSON.stringify(result), 'PX', ttl);
}
```

and it clearly set the ttl in milliseconds. The ttl in the response cache is set in seconds though.

**To Reproduce** Steps to reproduce the behavior:

**Expected behavior**

Seconds should be used

**Environment:**

- OS: any
- NodeJS: any
- `@envelop/*` versions: any
- `@envelop/core`: `any`

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the response-cache-redis implementation and the code path that receives the response-cache TTL. Check how the Redis SET command interprets the TTL, then verify the cache expiration uses seconds consistently. Add or update coverage for the TTL unit and confirm the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
redis, typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.