hasura / hasura/graphql-engine
now() does not work with ascending streaming subscriptions
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.7.0
CLI Version (for CLI related issue): 2.7.0
### Environment
CE
### What is the expected behaviour?
The now keyword should return new items in the stream from when the subscription was initialized.
### Keywords
Streaming subscriptions
### What is the current behaviour?
The now keyword returns an empty data set even when there are items in the stream after "now".
### How to reproduce the issue?
1. Create a streaming subscription with direction "ASC" and initial value of "now"
2. Create new items in the table you're tracking with the stream
3. Observe no new items showing in the stream
### Screenshots or Screencast

### Please provide any traces or logs that could help here.
### Any possible solutions?
My hypothesis is that now() is re-initialized on every refetch interval. Thus, now will always be greater than the next item in the stream's cursor value.
Steps:
Stream initialized with now (let's say this is the baseline of 0 seconds)
Message gets put on stream .5 seconds after initialization
Refetch interval fires at 1 second
When refetch fires, now is read as the current server time, but the message is now .5 seconds in the past, so it does not show up on the stream.
### Can you identify the location in the source code where the problem exists?
Unfortunately I am not familiar with Haskell, so I wasn't able to pinpoint this. Will update the post if I find the issue.
### If the bug is confirmed, would you be willing to submit a PR?
I would be willing to take a shot at it, although I have no prior Haskell experience as mentioned.
Contributor guide
Assessment
This issue has not been assessed yet.