Skip to content

feat: Add branch to use taskbroker-client#110001

Open
markstory wants to merge 6 commits intomasterfrom
chore-use-taskbroker-client
Open

feat: Add branch to use taskbroker-client#110001
markstory wants to merge 6 commits intomasterfrom
chore-use-taskbroker-client

Conversation

@markstory
Copy link
Member

Add branches that let us opt-in to using taskbroker-client in deployments via environment variables.

Refs STREAM-610

Add branches that let us opt-in to using taskbroker-client in
deployments via environment variables.

Refs STREAM-610
Fix type errors in sentry.taskworker, there are likely more.
@linear-code
Copy link

linear-code bot commented Mar 5, 2026

use some cheatcodes to get around mypy
There are instanceof checks in the scheduler that we need to work
around.
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 7, 2026
@markstory markstory marked this pull request as ready for review March 7, 2026 02:35
@markstory markstory requested a review from a team as a code owner March 7, 2026 02:35
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

tags: Tags | None = None,
sample_rate: float | None = None,
) -> None:
sentry_metrics.incr(name, amount=int(value), tags=tags, sample_rate=sample_rate or 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falsy sample_rate of 0.0 silently becomes 1.0

Low Severity

The expression sample_rate or 1.0 uses Python's truthy evaluation, which means an explicit sample_rate=0.0 would be treated as falsy and silently replaced with 1.0. The correct check is sample_rate if sample_rate is not None else 1.0. This affects incr, distribution, and timer.

Additional Locations (2)

Fix in Cursor Fix in Web

app.load_modules()
run_storage = RunStorage(redis_clusters.get(redis_cluster))
if settings.TASKWORKER_USE_LIBRARY:
from django.conf import settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant re-import of settings inside branch

Low Severity

from django.conf import settings is imported at line 143 (needed for the if settings.TASKWORKER_USE_LIBRARY check on line 145), then redundantly imported again at line 146 inside that same if block. The second import is dead code.

Fix in Cursor Fix in Web

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant