Scheduled Tasks



  • Okay so, on the project I'm working on, we have a we API that does most of the heavy lifting. But someone made an odd decision a year or two ago: We'd make a special "command" API that we send messages to that ultimately let it act like an arbitrary number of APIs. Someone always comes up with something dumb like this it seems.

    This one, at least, is only used by automated tasks. Someone went and implemented CRON themselves, for some reason, and use it to do things like, "A user registered for our app, 30 days from now, send them this email, personalized" - we basically have hundreds+ pathetic tasks like this, that are all simple PUTs.

    Well, we want to be able to handle retries, logging, etc, which this random person's homebrew library isn't great for. So we're looking at other ways: We could do a polling Azure Function, which would look up our scheduled tasks in the database and run the right ones. Or we could go with the basic Azure Scheduler itself.

    We decided that that last option would be ideal, since we wouldn't have to change how our application operates, and could just change the scheduler API's implementation on our side. The problem is, the latest documentation on the scheduler does not work.

    I mean look:
    https://docs.microsoft.com/en-us/rest/api/scheduler/jobs/createorupdate

    Between those, you should be able to send a basic request and try something, right? Wrong! No matter what you do, even copying in their sample verbatim, you get told your object is malformed!

    I'm also being told that perhaps programmatically spawning hundreds of tasks this way may not be a good use of the scheduler. Sure, fine, but I want to test it first. Which I can't do, apparently.

    So maybe I'll end up using a polling function after all.

    Any thoughts, anyone?



  • So, I've ended up settling on an Azure Function, but because of some data concerns I still have a lot to learn. This should be interesting.


Log in to reply