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

Refactor MailKitClientFactory to remove semaphore and recreate a client for each connection #2849

Merged

Conversation

sammychinedu2ky
Copy link
Contributor

Summary

The initial implementation worked well in a scoped DI setup, ensuring that each web request received a fresh SMTP client. However, in an Orleans grain scenario where grains can remain active for extended periods, the SMTP client may become disconnected due to inactivity.

Describe your changes here.

  • Removed the SemaphoreSlim as it was no longer needed.
  • Ensured that a new SmtpClient instance is created for each request to prevent stale connections.

@IEvangelist IEvangelist reopened this Mar 21, 2025
@IEvangelist IEvangelist enabled auto-merge (squash) March 21, 2025 14:45
@IEvangelist IEvangelist merged commit bfd3177 into dotnet:main Mar 21, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants