Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't close MongoDB watch stream #5148

Open
monad98 opened this issue Nov 29, 2022 · 3 comments
Open

Can't close MongoDB watch stream #5148

monad98 opened this issue Nov 29, 2022 · 3 comments

Comments

@monad98
Copy link

monad98 commented Nov 29, 2022

How frequently does the bug occur?

All the time

Description

I can't close the watch stream unless I get at least one change from the stream.
watch.return() only works when the for loop is executed at least once.

Stacktrace & log output

No response

Can you reproduce the bug?

Yes, always

Reproduction Steps

const watch = col.watch({
  filter: {
    operationType: "insert",
  },
});

setTimeout(() => {
  console.log("timed out");
  watch.return();
}, 10 * 1000);

for await (const change of watch) {
  const { fullDocument } = change;
  console.dir(fullDocument);
}

console.log("this is never printed");

I don't insert a document for 10 seconds, then it should run the last console.log, but it doesn't and stuck in for loop.
If I insert one within 10 seconds, it works as expected.

Version

"realm": "11.3.0"

What SDK flavour are you using?

Atlas App Services (auth, functions, etc.)

Are you using encryption?

No, not using encryption

Platform OS and version(s)

Node

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@kneth
Copy link
Member

kneth commented Nov 30, 2022

@monad98 We recently fixed a similar issue in Realm Web (see #4700), and it sounds like it is the same. We need to investigate and possibly port the fix to Realm JS.

@monad98
Copy link
Author

monad98 commented Aug 22, 2023

@kneth @kraenhansen this fix also works for node. Any plan to apply this to NodeJs version?

@monad98 We recently fixed a similar issue in Realm Web (see #4700), and it sounds like it is the same. We need to investigate and possibly port the fix to Realm JS.

@kneth
Copy link
Member

kneth commented Aug 23, 2023

@monad98 Thank you for bringing it up. It should be a relative small fix for node.js, and we should try to get in it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants