Skip to content

Commit

Permalink
finalize disposal of db connection (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mnich authored Jan 27, 2025
1 parent ed3d384 commit 5a529cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
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

0 comments on commit 5a529cc

Please sign in to comment.