Skip to content

Conversation

@bukzor
Copy link
Contributor

@bukzor bukzor commented Jul 8, 2025

Currently this thread will wait for sleep(self.flush_interval) to end before
checking self._running. We can do better by using an Event.

Now it will wait for self.flush_interval or until self.__shutdown_requested
is set, whichever is shorter.

@codecov
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.72%. Comparing base (a7b2d67) to head (81cf1a2).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/sessions.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4561      +/-   ##
==========================================
+ Coverage   80.68%   80.72%   +0.04%     
==========================================
  Files         156      156              
  Lines       16482    16481       -1     
  Branches     2802     2801       -1     
==========================================
+ Hits        13299    13305       +6     
+ Misses       2299     2297       -2     
+ Partials      884      879       -5     
Files with missing lines Coverage Δ
sentry_sdk/sessions.py 79.72% <87.50%> (+0.55%) ⬆️

... and 3 files with indirect coverage changes

@bukzor bukzor requested a review from untitaker July 8, 2025 21:18
@bukzor bukzor marked this pull request as ready for review July 8, 2025 21:18
@bukzor bukzor requested a review from a team as a code owner July 8, 2025 21:18
@bukzor bukzor enabled auto-merge (squash) July 8, 2025 22:25
bukzor added a commit that referenced this pull request Jul 8, 2025
This follows the precedent set in transport.flush, and helps me with my project
to assert thread hygeine in sentry test suite (related: DI-1008), but also makes
the system much more deterministic for everyone.

This will cause shutdown to be quite slow until #4561 goes in. So I'd reject
this if you reject that.
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

ignore previous review, was confused by the negation

@bukzor bukzor merged commit 5709b25 into master Jul 9, 2025
137 checks passed
@bukzor bukzor deleted the bukzor/session-flusher-stop-faster branch July 9, 2025 14:15
bukzor added a commit that referenced this pull request Jul 9, 2025
This follows the precedent set in transport.flush, and helps me with my project
to assert thread hygeine in sentry test suite (related: DI-1008), but also makes
the system much more deterministic for everyone.

This will cause shutdown to be quite slow until #4561 goes in. So I'd reject
this if you reject that.
szokeasaurusrex added a commit that referenced this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants