hasura / hasura/graphql-engine

now() does not work with ascending streaming subscriptions

Open
#8,553 1 comment 4 reactions 0 assignees View on GitHub
k/bug
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
![image](https://user-images.githubusercontent.com/12026053/171932573-fabe1e64-264e-414d-892b-dcb4fd2bb076.png)

### 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.