I am performing periodic task (for example, every 5 minutes) using below method. Is there any better alternative than below solution

# Start the periodic update self.update_interval = 5 # Update interval in minutes self.start_periperodic_update() # Schedule the end-of-day routine 

def start_periodic_update(self):
        """
        Start a periodic update of portfolio metrics using a timer-based approach.
        """
        self.update_metrics()  # Initial update call
        self.schedule_next_update()

    def schedule_next_update(self):
        """
        Schedule the next update after the specified interval.
        """
        self.timer = threading.Timer(self.update_interval * 60, self.update_metrics)
        self.timer.start()

    def update_metrics(self):
        """
        Update portfolio metrics, called by the periodic timer.
        """
        self.portfolioDrawDown.update_max_market_values_and_drawdowns()
        self.objectStorageManagement.persist_to_disk()

        # Schedule the next update after this one finishes
        self.schedule_next_update()

    def cancel_periodic_update(self):
        """
        Cancel the periodic updates if needed (e.g., on shutdown).
        """
        if hasattr(self, 'timer'):
            self.timer.cancel()