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

Duplicate events #406

Closed
jdgjsag67251 opened this issue May 13, 2024 · 2 comments
Closed

Duplicate events #406

jdgjsag67251 opened this issue May 13, 2024 · 2 comments

Comments

@jdgjsag67251
Copy link

jdgjsag67251 commented May 13, 2024

It appears that, on the client, added and changed (and maybe others?) events get called multiple times for clients that originated the request when using observe events like so:

Collection.find().observe({
    changed() {
        console.log("Changed");
    }
});

Collection.update("7pmHJGvoT5CESRrwv", { $set: { someField: true } });

// Changed 3x

Similarly to #51 this causes flickers for updates. But we also have code that calls observe directly that assumes that added is only called once per insert.

Sequential WebSocket messages
{
    "msg": "method",
    "id": "1",
    "method": "/collection/update",
    "params": [
        {
            "_id": "7pmHJGvoT5CESRrwv"
        },
        {
            "$set": {
                "someField": true
            }
        },
        {}
    ]
}
{  "msg": "updated", "methods": ["1"] }
{  "msg": "result", "id": "1"  }
{
    "msg": "changed",
    "collection": "collection",
    "id": "7pmHJGvoT5CESRrwv",
    "fields": {
        "someField": true
    }
}

cultofcoders:redis-oplog is at the top of the packages file. We are using https://github.com/radekmie/changestream-to-redis though, so maybe it inserts the changes too late? We are also using collection-hooks.

Copy link

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee you issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

@jdgjsag67251
Copy link
Author

I figured it out! For anyone else having this issue, you do have to have pushToRedis set to true even if you use an external publisher

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

No branches or pull requests

1 participant