I have this function that gets called 5-6 times per second, performs some internal processing, and then sends a command to an external system. The external system isn't fit the handle commands coming in at this rate. How can I make it so that the function only goes through its processing once a second (or some other configurable amount) regardless of how often the function is called?
I tried using a lock, but that just resulted in subsequent function calls waiting for the previous one to finish. I feel like I'm overthinking this.