Skip to content

refactor: use datetime/timedelta for exponential backoff elapsed time - #1876

Closed
TrueFurina wants to merge 1 commit into
tableau:developmentfrom
TrueFurina:refactor/datetime-timedelta-backoff
Closed

refactor: use datetime/timedelta for exponential backoff elapsed time#1876
TrueFurina wants to merge 1 commit into
tableau:developmentfrom
TrueFurina:refactor/datetime-timedelta-backoff

Conversation

@TrueFurina

Copy link
Copy Markdown

Summary

Per #1336 (and the maintainer's suggestion in the thread): swaps the raw time.time() / monotonic-elapsed arithmetic in tableauserverclient/exponential_backoff.py for datetime/timedelta.

Changes

  • tableauserverclient/exponential_backoff.py:
    • self.start_time = time.time()self.start_time = datetime.now()
    • elapsed = time.time() - self.start_timeelapsed = (datetime.now() - self.start_time).total_seconds()
    • time.sleep(...) retained (sleep still needs seconds)

Behavior is unchanged: elapsed is still a float number of seconds, timeout comparison and error message are identical.

Verification

  • Syntax check passed
  • Timer still sleeps with backoff and raises TimeoutError when the deadline passes (verified locally with a 0.01s timeout)

@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @TrueFurina to sign the Salesforce Inc. Contributor License Agreement.

@jacalata

jacalata commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Hi @TrueFurina — apologies, my earlier "PRs welcome" note on #1336 was too optimistic. Looking closely: (datetime.now() - self.start_time).total_seconds() works the same way as time.time() - self.start_time; nothing downstream uses timedelta types; both are equally subject to wall-clock jumps. Closing this and updating the issue. Really sorry for the wasted effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants