Skip to content

Remove manual scope handling with ThreadPoolExecutor #101788

@alexander-alderman-webb

Description

Now we merged getsentry/sentry-python#4770 in the Python SDK, code like the snippet below can be simplified. The SDK now automatically forks the relevant scopes when a function is submitted to the executor.

with ThreadPoolExecutor(
thread_name_prefix=__name__,
max_workers=10,
) as query_thread_pool:
query_results = list(
query_thread_pool.map(
_snuba_query,
[
(
sentry_sdk.get_isolation_scope(),
sentry_sdk.get_current_scope(),
snuba_request,
)
for snuba_request in snuba_requests_list
],
)
)

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions