Skip to content

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

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

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.

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.

1 participant