tableau / server-client-python

A Python library for the Tableau Server REST API
https://tableau.github.io/server-client-python/
MIT License
656 stars 422 forks source link

Adjusting tiered license levels slow to reflect update #1121

Open jorwoods opened 2 years ago

jorwoods commented 2 years ago

Describe the bug

When making an adjustment to a tiered license level on a site, trying to add the user for that tier too soon after can fail. Even if the server responds to one query with the correct number, the next query can return the old number. Unclear how long it takes for this setting to propagate.

Versions

Details of your environment, including:

To Reproduce

Steps to reproduce the behavior. Please include a code snippet where possible.

import itertools as it
import time

import tableauserverclient as TSC

# sign in to server as server admin
site = server.sites.get_by_id(server.site_id)
existing_limit = site.tier_creator_capacity
expected_limit = existing_limit + 1

site.tier_creator_capacity = expected_limit
site = server.sites.update(site)

results = [existing_limit] * 3

for i in it.count(1):
    print(f"{i=}; {results=}; {expected_limit=}")
    time.sleep(1)
    site = server.sites.get_by_id(site.id)
    results[i%3] = site.tier_creator_capacity
    if all(r == expected_limit for r in results):
        break

print(f"Got a matching result after {i} attempts.")

Results

What are the results or error messages received? Can end up taking anywhere between 10 seconds and 3 minutes before a consistent response is returned from the API about the tiered license capacity.

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

jacalata commented 2 years ago

I'm not sure how long this should take, but we should find out and add it to the docs.

jorwoods commented 2 years ago

The curious part is: hypothetically say you're trying to update the number from 10 to 11. The response will seem to randomly return either 10 or 11 for some amount of time before it consistently reflects the updated number. This behavior also happens in the Web UI, but is easier to reproduce via REST (as well as being where I first noticed the issue).