Make the monitoring command slightly simpler and handle being called on any variant analysis#1690
Conversation
koesie10
left a comment
There was a problem hiding this comment.
LGTM, thanks for cleaning this up!
Since you mention the VariantAnalysisMonitorStatus is only used in tests, would it make sense to remove the return type completely and rely on the actual behaviour in the tests, rather than on the return type? It now seems like we're testing something that doesn't actually get used.
I agree with you, but I didn't want to go too far with changing things in this PR. I'll open a tech-debt issue about it and we can discuss there. |
| function processApiStatus(status: ApiVariantAnalysisStatus, failureReason: string | undefined): VariantAnalysisStatus { | ||
| if (status === 'in_progress') { | ||
| return VariantAnalysisStatus.InProgress; | ||
| } else if (failureReason !== undefined) { |
There was a problem hiding this comment.
Is this different than if (failureReason) ?
There was a problem hiding this comment.
It is technically different because the empty string is falsy. Practically I'm not sure it'll make a difference.
If the failure message is set to the empty string that's not great, but I'd say it's a bug earlier in the system rather than here. So here I generally prefer to be explicit about checking for undefined rather than using the implicit conversion to a boolean.
elenatanasoiu
left a comment
There was a problem hiding this comment.
Had one question, but looks great!
This PR aims to make the variant analysis monitoring command able to handle all states and also be slightly cleaner in its logic. I don't think any of the changes in this PR are critical, but I think they are all improvements.
The changes made are:
_onVariantAnalysisChangefrom three different places under various conditions, fire it from one place and always fire it in every loop right after getting the updated variant analysis summary.VariantAnalysisMonitorResultto only the cases that we actually use, and make it fit better to the variant analysis summary status.Checklist
ready-for-doc-reviewlabel there.