def add_invocations(instance, invocations, key='invocations'):
    """Add invocations to instance.runtime_props[key] in a safe fashion.

    Use instance.update() to allow the append to be safe in face
    of concurrent updates.
    """
    def append_invocation(old, new):
        new[key] = list(new.get(key, [])) + invocations
        return new
    instance.update(on_conflict=append_invocation)