tableau / server-client-python

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

send_request_while_show_progress_threaded() in server.endpoint wait 1 second for nothing #1309

Closed btribonde closed 8 months ago

btribonde commented 10 months ago

Hello,

I use Tableau Server Client and recently upgrade from 0.13 to 0.26.

I usually download many workbooks for backup purpose and it works fine (2 minutes for complete retrieval).

Updating the library raised this time to 30 minutes !

The problem is in the recent send_request_while_show_progress_threaded() method, especially the sleep(1) which create a 1 second wait for nothing. If you don't want to rewrite it correctly, please at least use a lower value. sleep(0.05) works fine and has only small impact on overall duration. Anyway it seems glitchy to say the least.

Regards

hahu66 commented 10 months ago

I upgrade to version v0.28 2 days ago and every request/call to a rest-api function takes up a one (1) second. I have a user-sync tool running 3 times daily for multiple environments. It used to be fast (1 minute) for v0.22, but now last for 56 minutes to complete with the same workload (824 user/group lines in a csv)

I reverted back to version 0.22 and now it is fast again.

Here some debug-log lines, where the lines without a timestamp is de restapi-lib function being called:

2023-11-10 10:19:33,570 - user_sync_tool - DEBUG - start syncing user myself@company.com on line 2 of users.csv
                        - matching_users, pagination_item = server.users.get(req_option)
2023-11-10 10:19:34,574 - user_sync_tool - DEBUG - ===== after searching existing user
2023-11-10 10:19:34,574 - user_sync_tool - DEBUG - found a matching user myself@company.com
2023-11-10 10:19:34,574 - user_sync_tool - DEBUG - ===== before if removed_users_group
                        - server.groups.remove_user(removed_users_group, new_user.id)
2023-11-10 10:19:35,576 - user_sync_tool - DEBUG - ===== after if removed_users_group
2023-11-10 10:19:35,576 - user_sync_tool - DEBUG - ===== add user to groups
2023-11-10 10:19:35,576 - user_sync_tool - DEBUG - ===== before try add user to groups
                        - server.groups.add_user(group, new_user.id)
2023-11-10 10:19:36,580 - user_sync_tool - DEBUG - ===== after try add user to groups
2023-11-10 10:19:36,580 - user_sync_tool - DEBUG - ===== before if user_updated
                        - new_user = server.users.update(new_user, password=password)
2023-11-10 10:19:37,580 - user_sync_tool - DEBUG - finished syncing user myself@company.com on line 2 of users.csv
2023-11-10 10:19:37,580 - user_sync_tool - DEBUG - start syncing user someelse@company.com on line 3 of users.csv