Skip to content

fix(sentry-apps): default flush to false for sentry app models#107309

Closed
cathteng wants to merge 3 commits intomasterfrom
cathy/sentry-apps/default-flush-false
Closed

fix(sentry-apps): default flush to false for sentry app models#107309
cathteng wants to merge 3 commits intomasterfrom
cathy/sentry-apps/default-flush-false

Conversation

@cathteng
Copy link
Contributor

@cathteng cathteng commented Jan 30, 2026

Sentry app and install outboxes for deletion are currently flushed synchronously, they should be async to prevent db contention when the deletion outboxes are processed.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 30, 2026
@cathteng cathteng marked this pull request as ready for review January 30, 2026 21:47
@cathteng cathteng requested review from a team as code owners January 30, 2026 21:47
@cathteng
Copy link
Contributor Author

There's a test failing that I'm not sure what the fix is yet

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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


@control_silo_model
class SentryApp(ParanoidModel, HasApiScopes, Model):
default_flush = False
Copy link
Contributor

Choose a reason for hiding this comment

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

default_flush attribute on SentryApp is unused

Low Severity

The default_flush = False attribute on SentryApp class is dead code. Unlike SentryAppInstallation which inherits from ReplicatedControlModel (which uses self.default_flush), SentryApp inherits from ParanoidModel, HasApiScopes, Model - none of which reference this attribute. Additionally, SentryApp has explicit implementations of save(), update(), and delete() that call outbox_context(..., flush=False) directly without ever reading self.default_flush. The attribute provides no functionality and may mislead developers into thinking it affects behavior.

Fix in Cursor Fix in Web

def delete(self, *args, **kwargs):
with outbox_context(transaction.atomic(using=router.db_for_write(SentryAppInstallation))):
with outbox_context(
transaction.atomic(using=router.db_for_write(SentryAppInstallation)), flush=False
Copy link
Member

Choose a reason for hiding this comment

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

If default_flush=False do we also need flush=False here? You could reference self.default_flush here if you wanted to be explicit 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I was doing this because the update and save functions in this model also do it, but we can change it

@getsantry
Copy link
Contributor

getsantry bot commented Feb 24, 2026

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Feb 24, 2026
@getsantry getsantry bot closed this Mar 4, 2026
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants