Lucy's Dilemma - Day 2 of the #25DaysOfServerless Challenge
Tags: scheduler, azure, serverless, 25daysofserverless
Published: 2019-12-03 14:00:17

---
title: Lucy's Dilemma - Day 2 of the #25DaysOfServerless Challenge
published: true
description: Lucy has a problem, and a serverless scheduler can help!
tags: Scheduler, Azure, Serverless, 25DaysOfServerless
cover_image: https://thepracticaldev.s3.amazonaws.com/i/s32bza5uuuut56qlqvym.png
---

This article is part of [#25DaysOfServerless](http://aka.ms/25daysofserverless). New challenges will be published every day from Microsoft Cloud Advocates throughout the month of December. Find out more about how Microsoft Azure enables your [Serverless functions](https://docs.microsoft.com/azure/azure-functions/?WT.mc_id=25days_devto-blog-jelooper). 

Have an idea or a solution? <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=I'm joining the @azureadvocates %2325DaysOfServerless challenge!! Learn more at https://aka.ms/25daysofserverless or see solutions at https://dev.to/search?q=25DaysOfServerless! Join me!" data-url="https://aka.ms/25daysofserverless' " data-hashtags="25DaysOfServerless"> Share your thoughts on Twitter! 
</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 

---

So, an evil grinch has stolen all the servers in the world, and we have to visit many countries to set things right! Now you're in Stockholm, Sweden, where the children are planning for the beautiful candlelit tradition happening on December 13th, when young girls wear crowns of candles and deliver breakfast to their family. Good thing you have a little time to fix this mess; everyone has fallen back to relying on sticky notes to help them remember to do things at certain times. Let's review today's challenge:

Every December 13th, Lucy is tasked with wearing a crown with six lit candles and delivering coffee and Lussekatter (sweet rolls) to all of her family members — her mother, father, sister, and brother. Each candle only lasts ten minutes before burning out, and she needs to be careful to keep the candles lit while she delivers the coffee and rolls!

![candles](https://media.giphy.com/media/3oxHQku0v7fogwwdq0/giphy.gif)

You can do this in Azure by means of a Logic App which includes a scheduling utility, paired with Twilio, to send yourself SMS reminders.

## Tip

It helps to sketch out Lucy's planned itinerary:

8:00 AM - start the coffee, set out 4 cups

8:25 AM - pour two cups

8:30 AM - light the candles

8:35 AM - deliver the coffee to Mom and Dad

8:39 AM - return to kitchen, fill two more cups

8:40 AM - relight the candles

8:45 AM - deliver the coffee to Sister and Brother

8:49 AM - return to kitchen, take a break!

## A Solution

In the Azure Portal, create an Azure Logic App by clicking the '+' at the top right and clicking 'create' and choosing your subscription and resource group. In the resource you created, choose "Create Blank Logic App" to open the Logic App Designer. 

Now you can search for connectors and triggers. I created a logic app to remind Lucy to light the candles by connecting the Schedule Trigger to the Twilio Action, making sure to run the scheduler for candles at 8:30 and 8:40 on Dec 13th at the proper time zone (Stockholm is UTC+1). 

Learn more about how to set up recurrent tasks [here](https://docs.microsoft.com/en-us/azure/connectors/connectors-native-recurrence/?WT.mc_id=25daysofserverless-github-jelooper).

Then, I created a test account on [Twilio](twilio.com) (it comes with $15.50 in credits), connected it to my phone number, and tested it using a sample Twilio number. So now, I'm all set to be reminded to light the candles at a given time.

![logic app](https://thepracticaldev.s3.amazonaws.com/i/3enjmuvqzodk0ej4tlrc.png)

Now you can focus on creating the task flow in the Azure Portal via the GUI tool. You could have a series of tasks for starting the process, for delivering the coffee, and for returning to the kitchen. Lucy will be all set! Here is a community solution:

![logic app](https://thepracticaldev.s3.amazonaws.com/i/mm1ffqdgtmsbcj1w0ed2.png)

In this solution by [Marcus Turewicz](https://github.com/marcusturewicz/25-days-of-serverless-challenge/tree/master/Day-02) you can see how the logic app is created as a sequence of scheduled tasks and delays. This works really well!

![fika](https://thepracticaldev.s3.amazonaws.com/i/zb2wl2j5v4jhjt12oevi.jpg)

---

Want to submit your solution to this challenge? Build a solution locally and then [submit an issue](https://github.com/microsoft/25-days-of-serverless/issues/new?assignees=&labels=challenge-submission&template=challenge-solution-submission.md&title=%5BCHALLENGE+SUBMISSION%5D+). If your solution doesn't involve code you can record a short video and submit it as a link in the issue desccription. Make sure to tell us which challenge the solution is for. We're excited to see what you build! Do you have comments or questions? Add them to the comments area below.

<hr/>

Watch for surprises all during December as we celebrate 25 Days of Serverless. Stay tuned here on dev.to as we feature challenges and solutions! Sign up for a [free account on Azure](https://azure.microsoft.com/free/?WT.mc_id=25days_devto-blog-jelooper) to get ready for the challenges!