-
-
Notifications
You must be signed in to change notification settings - Fork 80
Guide users to use WhenStateIsFor with a IScheduler instance. #864
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
Guide users to use WhenStateIsFor with a IScheduler instance. #864
Conversation
…nd provide a obsolete WhenStateIsFor without s scheduler parameter for backwards compatibility.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #864 +/- ##
==========================================
- Coverage 80.79% 80.70% -0.09%
==========================================
Files 167 167
Lines 4217 4229 +12
Branches 419 423 +4
==========================================
+ Hits 3407 3413 +6
- Misses 640 642 +2
- Partials 170 174 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
|
Not sure why you want to obsolete this? Please explain. |
|
Passing in a injected IScheduler is the more correct approach which is also unit testable. I think it confuses ppl currently since there were also questions about this on Discord. However since ppl might be using WhenStateIsFor without IScheduler currently it will be breaking if you completely remove it so I didnt and just made the one without a IScheduler parameter obsolete. |
|
We discussed this some time ago when Rick created the issue for this. I agree it is preferred for several reasons to pass the Scheduler. This will now give a warning when you don't. Someone might have a case where not passing the scheduler is 'ok'. Maybe if you only ever have short times where it is no problem if the event fires after the app unloads AND are not interested in Unit testing. So the trade off is between preventing user from a mistake vs forcing users to pass a scheduler while it's not really needed. |
I will not have user "have to" pass it. Warning should be ok. Not worth it to make it a breaking change. What you think @FrankBakkerNl ? Should we go with this? |
|
I think so, if ever we would change our minds we can just remove the obsolete attribute |
Breaking change
Proposed change
This is a Source compatible change that will guide users to provide a ISchedule instance to WhenStateIsFor. This is however a binary breaking change but I think that might be fine as users will recompile anyway after updating netdaemon.
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: