def METHOD_NAME(self, i: Optional[int] = None) -> None:
    """Commit progress to stateful storage, if there have been no errors.
    If an index `i` is provided, only commit if we are at the appropriate interval
    as per `config.commit_state_interval`.
    """
    on_interval = (
        i
        and self.config.commit_state_interval
        and i % self.config.commit_state_interval == 0
    )
    if i is None or on_interval:
        self.stateful_ingestion_handler.commit_checkpoint()