Change default expiry for presence per channel?
coryvirok opened this issue · comments
I have a couple of levels of presence for the project I'm working on.
- Users online right now for the whole project
- Users looking at a specific page
I'd like to change the default 15 second timeout for when disconnect events are sent to connected users on a per-channel basis.
For projects, I'd like the event to fire after 15 seconds of non-presence. For page presence, I'd like it to fire after 5 seconds.
I thought this was configurable via my resource type definition using the maxAgeSeconds
policy:
{
name: 'projectPresence',
expression: new RegExp('^presence:/rollbar/project/[0-9]+$'),
type: 'Presence',
policy: { cache: true, maxAgeSeconds: 15 },
authProvider: {
authorize: security.resourceTokenValidator
}
},
{
name: 'projectItemPresence',
expression: new RegExp('^presence:/rollbar/project/[0-9]+/item/[0-9]+$'),
type: 'Presence',
policy: { cache: false, maxAgeSeconds: 5 },
authProvider: {
authorize: security.resourceTokenValidator
}
}
However, it looks like this 15 second number is hard-coded here:
https://github.com/zendesk/radar/blob/master/core/lib/resources/presence/presence_manager.js#L16
You are right, this should be a configurable and was an oversight when I rewrote presence. The test suites set their custom expiry so the tests are more faster, however I never made it configurable. I will let you know when I have the fix. If you want this urgently, a PR is always welcome!
PS: maxAgeSeconds is a config for messageList type for pruning old messages. I would suggest calling this 'userExpirySeconds' for this.
This is being addressed in #104 It should be available soon through npm. I will update here once I have the new version.
This is fixed in version 0.11.1.
awesome, thanks!