Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dispose of client should only flush #1354

Merged
merged 22 commits into from
Jan 5, 2022

Conversation

SimonCropp
Copy link
Contributor

fixes #599

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

I wonder if we need this also on Hub.cs

@SimonCropp
Copy link
Contributor Author

@bruno-garcia does the hub exist in the container? and hence has the same problem?

@bruno-garcia
Copy link
Member

bruno-garcia commented Dec 5, 2021

Yes. Both are registered here:

services.TryAddTransient<ISentryClient>(c => c.GetRequiredService<IHub>());
services.TryAddTransient(c => c.GetRequiredService<Func<IHub>>()());

In fact ISentryClient resolves the Hub instance even so it'll go through it

@lucas-zimerman
Copy link
Collaborator

Test is complaining about this: Sentry.Tests.ApiApprovalTests.Run: VerifyException : Results do not match.

CHANGELOG.md Outdated Show resolved Hide resolved
@SimonCropp
Copy link
Contributor Author

@bruno-garcia so what do we do in hub.dispose?

    public void Dispose()
    {
        _options.LogInfo("Disposing the Hub.");

        if (Interlocked.Exchange(ref _isEnabled, 0) != 1)
        {
            return;
        }

        if (_integrations?.Length > 0)
        {
            foreach (var integration in _integrations)
            {
                if (integration is IInternalSdkIntegration internalIntegration)
                {
                    internalIntegration.Unregister(this);
                }
            }
        }

        (_ownedClient as IDisposable)?.Dispose();
        _rootScope.Dispose();
        ScopeManager.Dispose();
    }

just return?

@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2022

Codecov Report

Merging #1354 (3c3968b) into main (0c62e9a) will decrease coverage by 1.40%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1354      +/-   ##
==========================================
- Coverage   84.20%   82.80%   -1.41%     
==========================================
  Files         219      219              
  Lines        7363     7350      -13     
  Branches     1416     1409       -7     
==========================================
- Hits         6200     6086     -114     
- Misses        728      838     +110     
+ Partials      435      426       -9     
Impacted Files Coverage Δ
src/Sentry/Internal/Hub.cs 72.97% <100.00%> (-0.29%) ⬇️
src/Sentry/SentryClient.cs 95.53% <100.00%> (+1.22%) ⬆️
src/Sentry/PlatformAbstractions/FrameworkInfo.cs 0.00% <0.00%> (-100.00%) ⬇️
...ntry/PlatformAbstractions/RegistryKeyExtensions.cs 0.00% <0.00%> (-100.00%) ⬇️
...Sentry/PlatformAbstractions/FrameworkInfo.NetFx.cs 0.00% <0.00%> (-70.43%) ⬇️
...rmAbstractions/NetFxInstallationsEventProcessor.cs 4.54% <0.00%> (-68.19%) ⬇️
...ntry/PlatformAbstractions/FrameworkInstallation.cs 25.00% <0.00%> (-37.50%) ⬇️
...ntry/Integrations/NetFxInstallationsIntegration.cs 28.57% <0.00%> (-28.58%) ⬇️
src/Sentry/PlatformAbstractions/RuntimeInfo.cs 53.44% <0.00%> (-5.18%) ⬇️
src/Sentry/Internal/SentryScopeManager.cs 96.00% <0.00%> (-4.00%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c62e9a...3c3968b. Read the comment docs.

@SimonCropp SimonCropp enabled auto-merge (squash) January 5, 2022 21:49
@@ -419,13 +421,28 @@ public void CaptureUserFeedback_EventIdEmpty_FeedbackIgnored()
//Assert
_ = sut.Worker.DidNotReceive().EnqueueEnvelope(Arg.Any<Envelope>());
}
[Fact]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[Fact]
[Fact]

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.

Make Dispose only Flush
4 participants