Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[avmfritz] Added initial refresh of Call Monitor channels and improved thread handling #9734
[avmfritz] Added initial refresh of Call Monitor channels and improved thread handling #9734
Changes from 2 commits
239b0f1
d03174b
f3a311a
cedb203
1533478
915f8d4
b845dc6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Wouldn't it be more elegant to do this in the constructor of
CallMonitorThread
?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.
Nice idea but I do not think that it makes a difference because we just set default values without querying the real data (which btw is not possible as the call Monitor is an event based communication).
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.
It probably doesn't, it just would avoid potential race conditions since this refresh calls happens asynchronously, and so does the thread creation. If a call came in right after thread creation, we might wrongly reset the state during the call.
Hypothetical, I know, but moving the initialization avoids that scenario :-)
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.
That is a valid point. On the opposite side we have the 2 hour recreation of the thread which will then lead to repeated initialization ... Might happen during an active call too.
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.
Good point. Maybe do the initialization in the
CallMonitor
constructor then?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.
It is not a real thread, but periodically scheduled jobs. What I mean is that the variable
refreshInterval
is a protected property within theAVMFritzBaseThingHandler
and I have no access to it inCallMonitor
constructor unless I add a method to expose it.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 do you need
refreshInterval
though? I thought the point of that initial refresh is to have the channels have undef/idle instead of NULL on startup. Is that correct? If so, how is the timing of that initialization dependent on the box poll interval?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.
It can be 5sec either. We just need a short time span to wait for the thread to be started as ist is done asynchronously too.
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.
I figured so, but in that case you don't need to access
refreshInterval
and could initialize the channels in the CallMonitor constructor (in the main thread, before starting the call monitor thread) just fine.The method for resetting the channels could be moved from
CallMonitorThread
toCallMonitor
(basically removerefreshChannels
and moveresetChannels
to its place), since the former can also call into the latter.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.
I changed it.