j3k0 / ganomede-notifications

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

Backport redis "poll.js" from ganomede-events #31

Open j3k0 opened 7 years ago

j3k0 commented 7 years ago

long-poll.coffee apparently only works in the context where a single instance of ganomede-notification is running. ganomede-events' should have improved this by relying on redis' pub-sub mechanism. Check if that's worth integrating in here.

elmigranto commented 7 years ago

Are you sure? If I remember correctly, LP just stores label -> [Function] mappings. Functions is a pair to be invoked: one for timeout (managed within LP class), one when triggered with #trigger(label).

From there, Redis listener has a chance to trigger it before timeout happens https://github.com/j3k0/ganomede-notifications/blob/master/src/notifications-api/index.coffee#L56

elmigranto commented 7 years ago

On the other hand, I just noticed there might be a bug with pub sub client itself, so don't close this one just yet.

j3k0 commented 7 years ago

Okay, I actually didn't even looked into the code and believed Leon about that... So it still was worth double checking.

elmigranto commented 7 years ago

I just noticed there might be a bug with pub sub client itself

Wish I wrote down what that was…