j3k0 / ganomede-notifications

Long-pull notification service for Ganomede
0 stars 0 forks source link

What happens if an users is connected on 2 devices? #6

Open j3k0 opened 9 years ago

j3k0 commented 9 years ago

A timeout is triggered whenever a new call to /messages is done.

From my understanding, if a user were to connect on 2 devices simultaneously, this would have the "dramatic" effect of causing them to flood the server with requests.

(Devices A and B)

A GET /message
B GET /message
A timeout triggered (because of B)
A GET /message
B timeout triggered (because of A)
B GET /message
A timeout triggered
...

The way it's designed, I don't see any simple solution to allow multiple client sharing the same username to run in parallel.

For now, I prevented the "dramatic" effect to happen with a simple fix.

elmigranto commented 9 years ago

We can have multiple long poll requests for each key instead of just one. So when new one is added with existing key, we let it be without bothering older one at all.