def termination_handler()

in gamelift-daemon/src/main.py [0:0]


def termination_handler(GameServerGroupName: str, GameServerId: str):
    """This method calls the drain pods method to evict non-essential pods from the node
    and waits to receive the termination signal from EC2 metadata."""
    # This method is never called because the instance never receives a termination signal
    
    print('Shutting down', flush=True)
    # Drain pods from the instance
    drain_pods()

    # Wait for termination signal
    while ec2_metadata.spot_instance_action == None:
        print('Waiting for termination notification', flush=True)
        sleep(10)
    exit(0)