Scheduling is the first operation we should start to rate-limit, as it is most expensive. Foremost, this protects against bad/rogue client implementations.
My suggestion (taking into account the state before Project 6 is implemented:
- Make a new field on GenericAssets: max-actuation-rate (a timedelta). How often we allow someone to re-compute things for their asset is a business decision I believe, so this is where it belongs.
- Update the
sensor/<id>/schedules/trigger endpoint, so it checks when the last scheduling job happened and if it was too recently, it does not make a new one, or it schedules one into the future (in this option we also need to check if in the future a scheduling job already exists).
Scheduling is the first operation we should start to rate-limit, as it is most expensive. Foremost, this protects against bad/rogue client implementations.
My suggestion (taking into account the state before Project 6 is implemented:
sensor/<id>/schedules/triggerendpoint, so it checks when the last scheduling job happened and if it was too recently, it does not make a new one, or it schedules one into the future (in this option we also need to check if in the future a scheduling job already exists).