Aug-23-2021, 03:37 AM
Yes, if your "checker" is hitting an external API you don't want to do that constantly. Often you don't need to be up-to-the-second, so polling at an interval (say 20 minutes) is sufficient but doesn't overload external servers.
Think about if this should happen in an interval. Do you want to know if this happens 3 times ever? Or maybe 3 times in a calendar day, or 3 times in a 24 hour period? So you'll have to have a counter and some method to reset the counter.
The checker depends on the specific API. Nice would be to keep track of the last time you checked. Then ask the API for any events since that time. That cuts down the data that gets transmitted. Otherwise you might have to parse a lot of data and see if any of it is in the relevant time frame.
Think about if this should happen in an interval. Do you want to know if this happens 3 times ever? Or maybe 3 times in a calendar day, or 3 times in a 24 hour period? So you'll have to have a counter and some method to reset the counter.
The checker depends on the specific API. Nice would be to keep track of the last time you checked. Then ask the API for any events since that time. That cuts down the data that gets transmitted. Otherwise you might have to parse a lot of data and see if any of it is in the relevant time frame.