Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Use persistence MongoDB, but there is a problem subscriptions #80

Merged
merged 4 commits into from
Dec 15, 2013

Conversation

mcollina
Copy link
Collaborator

I used the DEMO offline mode code.
It worked well the first time.
But when I reload the page, subscriptions collection will insert a new record.
So the same clientId has two records in subscriptions collection.
Now I publish a message and connect client, we will get two offline messages.
What's wrong with me?
Thank you.

@mcollina
Copy link
Collaborator

Probably you are hitting some behaviors not covered by the unit tests of Mosca. It's fine to iron out bugs.
The DEMO works when you press 'run', so nothing should happen when you reload.

I tested the issue and it's present also without Mongo, so it's something else.
I'll work on this next week.

@mcollina
Copy link
Collaborator

Can you try https://github.com/mcollina/mosca/tree/fix-80 and see if it solves this issue?

Thanks.

@mcollina
Copy link
Collaborator

Ok, everything should be fixed for all persistence.
Sorry for the weird bug!

@speed1speed1
Copy link
Author

Nice work!
This subscriptions issue has been solved.
But I find the other issue from packets collection.
Packets collection should be store the offline message.
Follow the previous steps.
I reconnect my client, subscriptions collection don't insert a new rocord.
Now my client is online.
I publish a message, my client receive a message.
But the packets collection still insert record.
when I reconnect again.
My client received a message has been received when online.

Otherwise we will queue offline messages when they are not due.
@mcollina
Copy link
Collaborator

It should be fixed with the latest commit. Can you please check?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 1cf36c5 on fix-80 into 4f13416 on master.

@speed1speed1
Copy link
Author

I tried again.
This Bug still exists.
My test step

  1. connect and subscription client.
  2. publish message
  3. end client connection.
  4. publish message
  5. reload page (It meant to reconnect)
  6. publish message
  7. reload page (It meant to reconnect), I receive message again.

The 5 step, client is online.
But when I publish message, packets collection insert record again.
So in the 7 step, I can receive the message
Because the 6 step, my packets collection has been inserted a record.

@mcollina
Copy link
Collaborator

Ok, I got the steps to reproduce it reliably here.
It is a little bit more complicated than what I originally thought.

@mcollina
Copy link
Collaborator

I have updated this branch with the new fix.
I hope it's fixed now, I am not able to reproduce it again here.

Let me know if it works. Thanks for reporting this!

In any case, it will be released as 0.15.0.

@speed1speed1
Copy link
Author

Nice!
I think this has been resolved.
Thank you very much.

mcollina added a commit that referenced this pull request Dec 15, 2013
Use persistence MongoDB, but there is a problem subscriptions
@mcollina mcollina merged commit e72aa51 into master Dec 15, 2013
@mcollina mcollina deleted the fix-80 branch December 15, 2013 19:01
@mcollina
Copy link
Collaborator

Released as 0.14.4.

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

Successfully merging this pull request may close these issues.

3 participants