race condition: new_relays_dict is modified during iteration