Closed seddonm1 closed 7 years ago
What's your use case here? Do you need exact timings, or is lazy and on-demand expiry evaluation enough? Nchan uses the latter method, and it would be quite easy to add a message expiry to a channel-events channel. If you want precisely timed message expiry events, that would require adding some more indexing of messages by sticking them into an expiry rbtree or timing wheel.
Hi slact, Sorry for the delayed reply.
My use case is that I have subscribers which run a local database (offline first mobile) and I want to notify them of expiry using the nchan internal mechanism.
I have used an interval job (ngx.timer.at) in OpenResty to monitor the :messages
nchan lists and push a new message to the nchan publisher if expired. It has worked for a few days now so I think you can close this issue.
Ok, I see. That's workable, but the list is only updated when the channel is accessed by Nchan. To be precise, you should see if the corresponding message key in Redis exists. You can check the lua scripts used in Nchan for the key format. (It's <namespace:>{channel:<channel_id>}:msg:<msgid>
.)
Thanks.
My process is:
I have been looking to implement a custom expiry function so i can notify subscribers of a message expiry.
I cannot figure out an easy way to do this so was planning to:
is there a better expiry subscriber notification pattern you can think of? like somehow using the redis keyspace events?