René's URL Explorer Experiment


Title: Performance [P2]: Defer synchronous Azure token acquisition by berndverst · Pull Request #199 · microsoft/durabletask-python · GitHub

Open Graph Title: Performance [P2]: Defer synchronous Azure token acquisition by berndverst · Pull Request #199 · microsoft/durabletask-python

X Title: Performance [P2]: Defer synchronous Azure token acquisition by berndverst · Pull Request #199 · microsoft/durabletask-python

Description: Summary AccessTokenManager.__init__() acquired an Azure access token eagerly, so constructing a DurableTaskSchedulerClient or DurableTaskSchedulerWorker performed a blocking credential round trip to Entra before any RPC was made. DTSDefaultClientInterceptorImpl.__init__() then called get_access_token() immediately, so the cost was paid even for instances that were never used. SandboxWorker goes through the same construction path. Token acquisition is now deferred to the first intercepted RPC: AccessTokenManager.__init__() no longer calls credential.get_token(); it starts with _token = None / expiry_time = None. DTSDefaultClientInterceptorImpl.__init__() no longer primes the token or the authorization header. The existing double-checked refresh lock in get_access_token() is untouched, so the deferred first acquisition is still single-flight across threads, and refresh-before-expiry behavior is unchanged. _intercept_call() already upserted the authorization header on every call, so no header is missing on the first request. This mirrors what DTSAsyncDefaultClientInterceptorImpl already does. Behavior change (timing only) Credential failures — for example an unavailable managed identity or a misconfigured DefaultAzureCredential — now surface from the first request instead of from the constructor. The exception type and message are unchanged; only the timing differs. This is called out in durabletask-azuremanaged/CHANGELOG.md under ## Unreleased. No public API changed: no signature changes, no renames, no removed symbols, no changed import paths. No warm-up hook was added, to avoid expanding public surface — callers that want fail-fast authentication can call credential.get_token(...) themselves before constructing a client or worker. Tests tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py: Added test_client_construction_does_not_acquire_token — asserts zero credential calls at client construction, exactly one on the first RPC, that the authorization header is present on that request, and that a second request reuses the cached token. Added test_worker_construction_does_not_acquire_token — asserts zero credential calls at worker construction. Added test_deferred_first_acquisition_performs_single_acquisition — 8 concurrent threads on a freshly constructed manager result in exactly one credential call, proving the deferred first acquisition is single-flight. Reworked test_concurrent_refresh_performs_single_refresh — the single-flight-on-expiry assertion is preserved, with the token now primed explicitly instead of relying on constructor acquisition. All three new tests were verified to fail against the unfixed source and pass with the fix. Verification Provider unit tests: pytest tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py tests/durabletask-azuremanaged/test_sandboxes_extension.py -q -> 45 passed (baseline 42; +3 new). Core unit tests: pytest tests/durabletask -q --ignore-glob="*_e2e.py" -> 681 passed, 7 skipped. Baseline on this branch had 1 failure in the timing-sensitive test_sync_client_recreate_cooldown_prevents_immediate_repeated_recreation, which is flaky/environmental and passes here. flake8 clean on all four changed files. pyright (repo pyrightconfig.json, strict): 0 diagnostics in the changed source files. pymarkdown -c .pymarkdown.json scan durabletask-azuremanaged/CHANGELOG.md: the two MD013 line-length findings are pre-existing on untouched lines; the added lines introduce none. Scope was kept strictly to this issue — no changes related to #192 (async single-flight refresh) or #195 (SDK version lookup caching), which live in the same files. Fixes #187

Open Graph Description: Summary AccessTokenManager.__init__() acquired an Azure access token eagerly, so constructing a DurableTaskSchedulerClient or DurableTaskSchedulerWorker performed a blocking credential round trip t...

X Description: Summary AccessTokenManager.__init__() acquired an Azure access token eagerly, so constructing a DurableTaskSchedulerClient or DurableTaskSchedulerWorker performed a blocking credential round trip t...

Opengraph URL: https://github.com/microsoft/durabletask-python/pull/199

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:39203653-4f34-5ae9-49f3-acd2323f2270
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9FE2:29F3CB:14E648:1B3792:6AFE44BC
html-safe-nonce368f6076f11369f5c1addff1ee16bfe4cc66c54539dce1eabfbb097f7ddaf788
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkUyOjI5RjNDQjoxNEU2NDg6MUIzNzkyOjZBRkU0NEJDIiwidmlzaXRvcl9pZCI6IjgyMzM4OTU5MTM5MjQyMTU5OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacebfcd08c2f888ce201e44c88510ca490797e32b2ef1d405d1ea8248858ac85e7
hovercard-subject-tagpull_request:4139759119
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/durabletask-python/pull/199/files
twitter:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
og:image:altSummary AccessTokenManager.__init__() acquired an Azure access token eagerly, so constructing a DurableTaskSchedulerClient or DurableTaskSchedulerWorker performed a blocking credential round trip t...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonef1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasece393ea11ad276623b946bc9663d3e7d6f564275
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/199/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F199%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F199%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/pull/199/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/199/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/199/files
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
Bernd Verst (berndverst)https://github.com/berndverst
mainhttps://github.com/microsoft/durabletask-python/tree/main
berndverst-defer-azure-token-acquisitionhttps://github.com/microsoft/durabletask-python/tree/berndverst-defer-azure-token-acquisition
Conversation 1 https://github.com/microsoft/durabletask-python/pull/199
Commits 1 https://github.com/microsoft/durabletask-python/pull/199/commits
Checks 18 https://github.com/microsoft/durabletask-python/pull/199/checks
Files changed https://github.com/microsoft/durabletask-python/pull/199/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/199/files
Performance [P2]: Defer synchronous Azure token acquisition https://github.com/microsoft/durabletask-python/pull/199/files#top
Show all changes 1 commit https://github.com/microsoft/durabletask-python/pull/199/files
30847fc Defer synchronous Azure token acquisition to first request Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/199/commits/30847fc1d1389e1efcb4e8d1913a342b4078de07
Clear filters https://github.com/microsoft/durabletask-python/pull/199/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/199/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/199/files
CHANGELOG.md https://github.com/microsoft/durabletask-python/pull/199/files#diff-1d1ece375471f083a849ea1b601985661b8bd8e7017fdb7fd5d10e02c4ca69f6
access_token_manager.py https://github.com/microsoft/durabletask-python/pull/199/files#diff-4c5045747bb8155edc42b000ebe6910fdbc6f40bf200fd07a6734d0efb646d42
durabletask_grpc_interceptor.py https://github.com/microsoft/durabletask-python/pull/199/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
test_durabletask_grpc_interceptor.py https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
durabletask-azuremanaged/CHANGELOG.mdhttps://github.com/microsoft/durabletask-python/pull/199/files#diff-1d1ece375471f083a849ea1b601985661b8bd8e7017fdb7fd5d10e02c4ca69f6
View file https://github.com/microsoft/durabletask-python/blob/30847fc1d1389e1efcb4e8d1913a342b4078de07/durabletask-azuremanaged/CHANGELOG.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/199/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/199/files#diff-1d1ece375471f083a849ea1b601985661b8bd8e7017fdb7fd5d10e02c4ca69f6
https://github.com/microsoft/durabletask-python/pull/199/files#diff-1d1ece375471f083a849ea1b601985661b8bd8e7017fdb7fd5d10e02c4ca69f6
durabletask-azuremanaged/durabletask/azuremanaged/internal/access_token_manager.pyhttps://github.com/microsoft/durabletask-python/pull/199/files#diff-4c5045747bb8155edc42b000ebe6910fdbc6f40bf200fd07a6734d0efb646d42
View file https://github.com/microsoft/durabletask-python/blob/30847fc1d1389e1efcb4e8d1913a342b4078de07/durabletask-azuremanaged/durabletask/azuremanaged/internal/access_token_manager.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/199/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/199/files#diff-4c5045747bb8155edc42b000ebe6910fdbc6f40bf200fd07a6734d0efb646d42
https://github.com/microsoft/durabletask-python/pull/199/files#diff-4c5045747bb8155edc42b000ebe6910fdbc6f40bf200fd07a6734d0efb646d42
https://github.com/microsoft/durabletask-python/pull/199/files#diff-4c5045747bb8155edc42b000ebe6910fdbc6f40bf200fd07a6734d0efb646d42
durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.pyhttps://github.com/microsoft/durabletask-python/pull/199/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
View file https://github.com/microsoft/durabletask-python/blob/30847fc1d1389e1efcb4e8d1913a342b4078de07/durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/199/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/199/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
https://github.com/microsoft/durabletask-python/pull/199/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.pyhttps://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
View file https://github.com/microsoft/durabletask-python/blob/30847fc1d1389e1efcb4e8d1913a342b4078de07/tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/199/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/199/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/199/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.