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(inactivity-tracking): Fix poll interval not initialized when tracker lifetime created #132

Merged
merged 3 commits into from
Jan 4, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: dotnet restore src/Lavalink4NET.sln

- name: Build
run: dotnet build src/Lavalink4NET.sln --no-restore --configuration ${{ matrix.configuration }} /property:Version=4.0.2
run: dotnet build src/Lavalink4NET.sln --no-restore --configuration ${{ matrix.configuration }} /property:Version=4.0.3

- name: Run tests
working-directory: ci
Expand Down
6 changes: 3 additions & 3 deletions src/Lavalink4NET.InactivityTracking/InactivityTrackerEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

public readonly struct InactivityTrackerEntry(DateTimeOffset inactiveSince, TimeSpan? timeout = null)
{
private readonly int _timeoutValue = timeout.HasValue
? (int)timeout.Value.TotalMilliseconds
private readonly long _timeoutValue = timeout.HasValue
? timeout.Value.Ticks
: -1;

public TimeSpan? Timeout => _timeoutValue < 0
? null
: TimeSpan.FromMilliseconds(_timeoutValue);
: TimeSpan.FromTicks(_timeoutValue);

public DateTimeOffset InactiveSince { get; } = inactiveSince;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ IInactivityTrackerLifetime CreateLifetime(IInactivityTracker inactivityTracker)

if (trackerOptions.Mode is InactivityTrackerMode.Polling)
{
var pollInterval = trackerOptions.PollInterval ?? _defaultPollInterval;
var pollInterval = trackerOptions.PollInterval ?? options.Value.DefaultPollInterval;

return new PollingInactivityTrackerLifetime(
label,
Expand Down
Loading