-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SessionStart double notifications #272
Conversation
Adds a 5 second time gap between events to prevent the notification being sent twice. fixes jellyfin#269
Corrected Nested 'if' statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a way to remove old values from the cache or this dictionary could grow very large.
…ctionary from growing
to prevent timer from initializing every time the SessionStartedEventArgs event is triggered
@@ -26,6 +32,7 @@ public SessionStartNotifier( | |||
{ | |||
_applicationHost = applicationHost; | |||
_webhookSender = webhookSender; | |||
_cleanupTimer?.Change(0, (int)TimeSpan.FromMinutes(30).TotalMilliseconds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this .Change()
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically that line is redundant, just to avoid compiler warnings
Unused field '_cleanupTimer'CA1823
do you have a better solution or idea for this? |
I think it might be enough to clean up old cached sessions when a new SessionStart event is triggered so we don't need to have this timer thread running in the backround |
run cleanup when the event is triggered
Adds a 5 second time gap between events to prevent the notification being sent twice. fixes #269