In this episode, we're starting to actually perform checks on our endpoints! We kick things off by creating a new Artisan console command named checks:perform
. This command is designed to gather all endpoints that are due for a check, based on their next_check
timestamp.
We walk through scaffolding the command, add some basic descriptions, and make sure it'll be ready to run automatically on a schedule (no one wants to run this manually). For now, the command grabs all endpoints where the next_check
value is less than or equal to the current datetime. We test this by running the command, checking that it grabs the expected number of endpoints due for checking, and confirm it updates as we modify the database.
Before actually doing the HTTP checks, we discuss a bit of design: instead of running checks immediately (which could slow things down), we'll eventually dispatch a job to a queue for each endpoint that needs checking. So, in this episode, we get the foundational logic in place to fetch the right endpoints and prepare for the job-dispatching part, which we'll tackle in the next episode!