Explore Library
Code QuizAdvanced

Rollback on Failed Deploy

Find the bug in a deployment routine that should roll back on a failed health check.

Codepython
def deploy(new_version, current_version):
    try:
        switch_traffic(new_version)
        run_health_check(new_version)
        print(f"Deployed {new_version}")
    except HealthCheckError:
        switch_traffic(new_version)
        print("Rolled back after failed health check")

Why does this deployment fail to actually roll back when the health check fails?