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

Fix database connection disposal on server shutdown #98

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License

namespace Jellyfin.Plugin.PlaybackReporting.Data
{
public interface IActivityRepository
public interface IActivityRepository : IDisposable
{
int RemoveUnknownUsers(List<string> known_user_ids);
void ManageUserList(string action, string id);
Expand Down
16 changes: 15 additions & 1 deletion Jellyfin.Plugin.PlaybackReporting/EventMonitorEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You should have received a copy of the GNU General Public License

namespace Jellyfin.Plugin.PlaybackReporting
{
public class EventMonitorEntryPoint : IHostedService
public class EventMonitorEntryPoint : IHostedService, IDisposable
{
private readonly ISessionManager _sessionManager;
private readonly IServerConfigurationManager _config;
Expand Down Expand Up @@ -368,5 +368,19 @@ public Task StopAsync(CancellationToken cancellationToken)

return Task.CompletedTask;
}

public void Dispose()
{
if (_repository != null)
{
_repository.Dispose();
_repository = null;
}
}

~EventMonitorEntryPoint()
{
Dispose();
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This information can be viewed as a multitude of different graphs, and can also

## Build

1. To build this plugin you will need [.Net 5.x](https://dotnet.microsoft.com/download/dotnet/5.0).
1. To build this plugin you will need [.Net 8.x](https://dotnet.microsoft.com/download/dotnet/8.0).

2. Build plugin with following command
```
Expand Down
Loading