Last active
December 7, 2020 19:17
-
-
Save sfmskywalker/d2d5c8150c93c5ba128b45acd65d19c9 to your computer and use it in GitHub Desktop.
Revisions
-
sfmskywalker revised this gist
Dec 7, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,6 @@ public void Build(IWorkflowBuilder workflow) } private ValueTask CleanoutTrash(ActivityExecutionContext context) => _cleanupService.CleanupTrashAsync(context.CancellationToken); private ValueTask WalkTheDog(ActivityExecutionContext context) => _dogWalkingService.WalkTheDogAsync(context.CancellationToken); private ValueTask DoTheDishes(ActivityExecutionContext context) => _dishCleaningService.DoDishesAsync(context.CancellationToken); } -
sfmskywalker created this gist
Dec 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ class ThisIsMyMonday : IWorkflow { private ITrashCleanupService _cleanupService; private IDogWalkingService _dogWalkingService; private IDishCleaningService _dishCleaningService; public CleanTrash(ITrashCleanupService cleanupService, IDogWalkingService dogWalkingService, IDishCleaningService dishCleaningService) { _cleanupService = cleanupService; _dogWalkingService = dogWalkingService; _dishCleaningService = dishCleaningService; } public void Build(IWorkflowBuilder workflow) { workflow .Cron("0 0 8 ? * MON *") .Then(CleanoutTrash) .Timer(Duration.FromHours(2)) // Sleep for 2 hours .Then(WalkTheDog) .Then(DoTheDishes); } private ValueTask CleanoutTrash(ActivityExecutionContext context) => _cleanupService.CleanupTrashAsync(context.CancellationToken); private ValueTask WalkTheDog(ActivityExecutionContext context) => dogWalkingService.WalkTheDogAsync(context.CancellationToken); private ValueTask DoTheDishes(ActivityExecutionContext context) => dishCleaningService.DoDishesAsync(context.CancellationToken); }