Skip to content
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

DisposableScheduler #624

Merged
merged 2 commits into from
Jan 29, 2022
Merged

Conversation

FrankBakkerNl
Copy link
Contributor

@FrankBakkerNl FrankBakkerNl commented Jan 21, 2022

Proposed change

Support Cron scheduling as an Extension of the IScheduler interface and allow
injection of an System.Reactive.Concurrency.IScheduler that logs exceptions and cancels scheduled tasks when the app is stopped.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • The code compiles without warnings (code quality chek)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@FrankBakkerNl FrankBakkerNl changed the title WIP DisposableScheduler DisposableScheduler Jan 21, 2022
@FrankBakkerNl FrankBakkerNl marked this pull request as ready for review January 22, 2022 20:39
}

/// <inheritdoc/>
public static IDisposable RunIn(IScheduler scheduler, TimeSpan timespan, Action action)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not very usefull anymore, they are just different names for something that already exists

/// <param name="action">Action to run</param>
public static IDisposable RunEvery(this IScheduler scheduler, TimeSpan timespan, Action action)
{
return scheduler.SchedulePeriodic(timespan, action);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these are not very usefull anymore, they are just different names for things that already exists

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we should just use the default. This is a new interface anyway. The important thing is the error handling safety.

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2022

Codecov Report

Merging #624 (4307844) into dev (0bd811e) will increase coverage by 0.54%.
The diff coverage is 85.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #624      +/-   ##
==========================================
+ Coverage   80.08%   80.63%   +0.54%     
==========================================
  Files         111      114       +3     
  Lines        2898     2969      +71     
  Branches      311      318       +7     
==========================================
+ Hits         2321     2394      +73     
+ Misses        450      442       -8     
- Partials      127      133       +6     
Flag Coverage Δ
unittests 80.63% <85.91%> (+0.54%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
....Extensions.Scheduling/DependencyInjectionSetup.cs 0.00% <0.00%> (ø)
...aemon.Extensions.Scheduling/SchedulerExtensions.cs 62.50% <62.50%> (ø)
...aemon.Extensions.Scheduling/DisposableScheduler.cs 87.80% <87.80%> (ø)
.../NetDaemon.Extensions.Scheduling/CronExtensions.cs 95.23% <95.23%> (ø)
...Daemon.Extensions.Scheduling/NetDaemonScheduler.cs 89.33% <0.00%> (+5.33%) ⬆️
...mon.HassClient/Internal/Net/WebSocketClientImpl.cs 69.44% <0.00%> (+8.33%) ⬆️
...NetDaemon.Extensions.Scheduling/DisposableTimer.cs 100.00% <0.00%> (+45.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bd811e...4307844. Read the comment docs.

@FrankBakkerNl FrankBakkerNl merged commit 53fba3e into net-daemon:dev Jan 29, 2022
@FrankBakkerNl FrankBakkerNl deleted the DispoasableScheduler branch December 22, 2022 22:22
Ikcelaks pushed a commit to Ikcelaks/netdaemon that referenced this pull request Dec 23, 2022
* Cron Scheduling

* FIx warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants