René's URL Explorer Experiment


Title: Add async task background worker by srothh · Pull Request #4591 · getsentry/sentry-python · GitHub

Open Graph Title: Add async task background worker by srothh · Pull Request #4591 · getsentry/sentry-python

X Title: Add async task background worker by srothh · Pull Request #4591 · getsentry/sentry-python

Description: Add a new implementation of the transport background worker based on an async task. This worker mostly mirrors the same functionality as the thread-based worker, with the exception that it exposes a non-blocking async flush (which can be awaited from an async context). Furthermore, the worker itself is not thread-safe and should be called using run_coroutine_threadsafe or similar when called from another thread (this is fixed and handled by the transport). I have kept the fork check from the threaded worker, but I am not sure if it is necessary as forking in an async application would also break the event loop. GH-4581

Open Graph Description: Add a new implementation of the transport background worker based on an async task. This worker mostly mirrors the same functionality as the thread-based worker, with the exception that it exposes ...

X Description: Add a new implementation of the transport background worker based on an async task. This worker mostly mirrors the same functionality as the thread-based worker, with the exception that it exposes ...

Opengraph URL: https://github.com/getsentry/sentry-python/pull/4591

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:3c021bd9-660a-ed3d-ac12-2d28efddafe6
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEA72:2223E9:234C1B:308F9E:6B00AF81
html-safe-noncec12882027ac933cbdba9229071d854d8e788782f9645a2784badf4852156eb7b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTcyOjIyMjNFOToyMzRDMUI6MzA4RjlFOjZCMDBBRjgxIiwidmlzaXRvcl9pZCI6IjY5MTcyNDYyODc0NDQyMjU5MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0d24c00506be10f2585c3ac0abfa23181d4b714022bb87a20fe1d5d2bdc71e5d
hovercard-subject-tagpull_request:2674039437
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/getsentry/sentry-python/pull/4591/files
twitter:imagehttps://avatars.githubusercontent.com/u/39389607?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/39389607?s=400&v=4
og:image:altAdd a new implementation of the transport background worker based on an async task. This worker mostly mirrors the same functionality as the thread-based worker, with the exception that it exposes ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec0dd5f5d6f515a591019ecd66df2c4eab3379c2d3b0777568a90d8c7ae10b79e
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release729d8cda69b3d267995675dfbf89ff27ccf61bf6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/4591/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F4591%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%2Fgetsentry%2Fsentry-python%2Fpull%2F4591%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=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/pull/4591/files
Reloadhttps://github.com/getsentry/sentry-python/pull/4591/files
Reloadhttps://github.com/getsentry/sentry-python/pull/4591/files
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues345 (345)https://github.com/getsentry/sentry-python/issues
Pull requests42 (42)https://github.com/getsentry/sentry-python/pulls
Discussionshttps://github.com/getsentry/sentry-python/discussions
Actionshttps://github.com/getsentry/sentry-python/actions
Security and quality2 (2)https://github.com/getsentry/sentry-python/security
Insightshttps://github.com/getsentry/sentry-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
sl0thentr0pyhttps://github.com/sl0thentr0py
srothh/transport-class-hierarchyhttps://github.com/getsentry/sentry-python/tree/srothh/transport-class-hierarchy
srothh/async-task-workerhttps://github.com/getsentry/sentry-python/tree/srothh/async-task-worker
Conversation 53 https://github.com/getsentry/sentry-python/pull/4591
Commits 22 https://github.com/getsentry/sentry-python/pull/4591/commits
Checks 0 https://github.com/getsentry/sentry-python/pull/4591/checks
Files changed https://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Add async task background worker https://github.com/getsentry/sentry-python/pull/4591/files#top
Show all changes 22 commits https://github.com/getsentry/sentry-python/pull/4591/files
9f24136 ref(transport): Add abstract base class for worker implementation srothh Jul 14, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/9f24136a4eaf618a683ed63a78498fb6995036e4
001f36c ref(transport): Add _create_worker factory method to Transport srothh Jul 14, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/001f36cbf4cf4f8c40ee49e318f88911eaba7fbd
401b1bc ref(worker): Add flush_async method to Worker ABC srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/401b1bcedc0f92322234f23cb45bc2a49715aec1
3f43d8f ref(worker): Move worker flush_async from Worker ABC srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/3f43d8fc0f464a10d568d86bf94ee0ec1346a2ab
15fa295 ref(worker): Amend function signature for coroutines srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/15fa295611edd059d79f2a6e0aedeb5db1707ca2
ef780f3 ref(worker): Add missing docstrings to worker ABC srothh Jul 24, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/ef780f341f994f3230e95c488f53945296e5adb8
f63e46f feat(transport): Add an async task-based worker for transport srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/f63e46fabdeffa4a59dc04e71f068f09be79ebf3
1804271 ref(worker): Make worker work with new ABC interface srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/18042718e28908218f66a98ac1f1d4d8a0e877e9
11da869 fix(worker): Check if callbacks from worker queue are coroutines or f… srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/11da869c06d3774026ec3f9d1010a091cbec05b3
779a0d6 ref(worker): Amend return type of submit and flush to accomodate for … srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/779a0d6ac83f7192b9fbf31339c716ddab675a30
0895d23 ref(worker): Add type parameters for AsyncWorker variables srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/0895d234cf93c404d850104e9a492a69be76e61f
bbf426b ref(worker): Remove loop upon killing worker srothh Jul 17, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/bbf426bee0662be8f02ecc590808a8380ad4b7f5
744dc8a feat(worker): Enable concurrent callbacks on async task worker srothh Jul 18, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/744dc8acbe9a71e26953259802676672c11c569e
fcc8040 fix(worker): Modify kill behaviour to mirror threaded worker srothh Jul 18, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/fcc8040c31675cae02de137958da95634dedac4b
9a43d9b ref(worker): add proper type annotation to worker task list srothh Jul 21, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/9a43d9b7a07b4a5785d79c7d7c5d6a2ad3c5559d
b5eda0e ref(worker): Refactor implementation to incorporate feedback srothh Jul 30, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/b5eda0e78ed8599c126c7e19def0749cd2fe0da5
9e380b8 ref(worker): fix queue initialization srothh Jul 30, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/9e380b89f860d09d44ba7e087a8a3809804b2745
ee44621 ref(worker): Add queue as optional to allow for initialisation in start srothh Jul 30, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/ee446215262b17987d418d0b480ebab863a559cd
d9f7383 ref(worker): Change to sync flush method that launches task srothh Jul 30, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/d9f7383a7d83517393514bf82b450d1df57f78f9
d2e647b ref(worker): Readd coroutine check for worker callbacks srothh Jul 30, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/d2e647b6553558524f777e9d4d6806e565f09762
859a0e2 ref(worker): Remove sync callbacks from worker processing for now srothh Jul 31, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/859a0e2914c4b8d9a820b7e648dd777300d64e3a
a0cdb4d Merge remote-tracking branch 'origin/srothh/transport-class-hierarchy… sl0thentr0py Aug 12, 2025 https://github.com/getsentry/sentry-python/pull/4591/commits/a0cdb4d12ba8f6eabdcb271bdd7af278369f2007
Clear filters https://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
sentry_sdk/worker.pyhttps://github.com/getsentry/sentry-python/pull/4591/files#diff-9e060067580d8f416a9f2a3d14e30d94cfc7011b00bb807c0486083f9ca7774c
View file https://github.com/getsentry/sentry-python/blob/a0cdb4d12ba8f6eabdcb271bdd7af278369f2007/sentry_sdk/worker.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/4591/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/4591/files#diff-9e060067580d8f416a9f2a3d14e30d94cfc7011b00bb807c0486083f9ca7774c
https://github.com/getsentry/sentry-python/pull/4591/files#diff-9e060067580d8f416a9f2a3d14e30d94cfc7011b00bb807c0486083f9ca7774c
https://github.com/getsentry/sentry-python/pull/4591/files#diff-9e060067580d8f416a9f2a3d14e30d94cfc7011b00bb807c0486083f9ca7774c
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
sl0thentr0pyhttps://github.com/sl0thentr0py
Aug 12, 2025https://github.com/getsentry/sentry-python/pull/4591/files#r2270046135
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
srothhhttps://github.com/srothh
Aug 12, 2025https://github.com/getsentry/sentry-python/pull/4591/files#r2270070745
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
srothhhttps://github.com/srothh
Aug 12, 2025https://github.com/getsentry/sentry-python/pull/4591/files#r2270090004
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
cursorhttps://github.com/apps/cursor
Jul 30, 2025https://github.com/getsentry/sentry-python/pull/4591/files#r2242431250
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
sentry_sdk/worker.py#L299-L302https://github.com/getsentry/sentry-python/blob/b5eda0e78ed8599c126c7e19def0749cd2fe0da5/sentry_sdk/worker.py#L299-L302
https://cursor.com/open?data=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImJ1Z2JvdC12MSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjU5NDFiNGM2LWJkOWMtNGQ0MC1hYzlmLTc5Y2ZjZGUzNTg5ZSIsImVuY3J5cHRpb25LZXkiOiJ5ZnRQenVIaE1TOUpNUWhZZGFwREhuMUJUdThtUmxRcVFnYjQxTU0ySlI4IiwiYnJhbmNoIjoic3JvdGhoL2FzeW5jLXRhc2std29ya2VyIn0sImlhdCI6MTc1Mzg3NzQxNCwiZXhwIjoxNzU0NDgyMjE0fQ.VOrIgubuc47oQgXG0YXfeqrmO30R5ppWOuxrY8CbkcktfGpeCKOlj9iLq6HbE89BOe_8RfOKHTsiBe3U8TrM1LnnNPR-Usq2pzNUc3ngyGSqQ7Q1IIjv2HZL8j8inhOV7cbcCRlb4twYcKSLJRj6wDe54qO71mY4pMW6kKkdCl7qyClPadDPJoYXfIKCB0tjabj8nP686XihAxxp7qE1WsxfVLx-Ez_6Fse8YVBi3Sw7CvV-fWGNRQBhvvfum2FWxccBKqVZQAppaLdzJomisuwkXp_q5IjVKw6_u27EueGp9zD9wisvr_GQ6WkF8vNZD2Rkr1gUS03bCqr8gFTtJg
https://cursor.com/agents?data=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImJ1Z2JvdC12MSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjU5NDFiNGM2LWJkOWMtNGQ0MC1hYzlmLTc5Y2ZjZGUzNTg5ZSIsImVuY3J5cHRpb25LZXkiOiJ5ZnRQenVIaE1TOUpNUWhZZGFwREhuMUJUdThtUmxRcVFnYjQxTU0ySlI4IiwiYnJhbmNoIjoic3JvdGhoL2FzeW5jLXRhc2std29ya2VyIiwicmVwb093bmVyIjoiZ2V0c2VudHJ5IiwicmVwb05hbWUiOiJzZW50cnktcHl0aG9uIiwicHJOdW1iZXIiOjQ1OTEsImNvbW1pdFNoYSI6ImI1ZWRhMGU3OGVkODU5OWMxMjZjN2UxOWRlZjA3NDljZDJmZTBkYTUifSwiaWF0IjoxNzUzODc3NDE0LCJleHAiOjE3NTQ0ODIyMTR9.EGa9m3GnlrSl5J9Xx6uEACRQeWxi1mREpOhDIO2xb_9k-0l8WxzARGLi_1ErpTgWrsQBQuZNXkCMP5q57WFVbeT_2STl_HnL01A-lY0VZBEf4H3kmMZfLw8RrRPitMYSANOHXflP0MAWgJI48DE5OXAa-cUy51v6tSnMnQV3Z6_soX1cn8nyoi1J5LCdRDLv8yN3c_FcTJyGj5n4z_7JL-xOkxOPwyLOiHL95XEzyzvINczjyplOgGnsXfld1iJK02BdSOAbkdaZx7rnCrBHwSJnUNA1eMb3D5nWGrkntg1YY4gTwb58sz_k5JTMVaDJY8P-wTW0FwlkSJ6d_QaNvw
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
srothhhttps://github.com/srothh
Jul 30, 2025https://github.com/getsentry/sentry-python/pull/4591/files#r2242453382
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4591/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.