-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f36345a
commit 9e63685
Showing
16 changed files
with
279 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
ManagedCode.Orleans.SignalR.Core/Helpers/TimeIntervalHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using ManagedCode.Orleans.SignalR.Core.Config; | ||
using Microsoft.AspNetCore.SignalR; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace ManagedCode.Orleans.SignalR.Core.Helpers; | ||
|
||
public static class TimeIntervalHelper | ||
{ | ||
public static TimeSpan GetClientTimeoutInterval(IOptions<OrleansSignalROptions> orleansSignalOptions, | ||
IOptions<HubOptions> hubOptions) | ||
{ | ||
var timeSpan = orleansSignalOptions.Value.ClientTimeoutInterval; | ||
|
||
if (hubOptions.Value.ClientTimeoutInterval.HasValue && timeSpan > hubOptions.Value.ClientTimeoutInterval) | ||
timeSpan = hubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
return timeSpan; | ||
} | ||
|
||
public static TimeSpan GetClientTimeoutInterval(IOptions<OrleansSignalROptions> orleansSignalOptions, | ||
IOptions<HubOptions> globalHubOptions, IOptions<HubOptions> hubOptions) | ||
{ | ||
var timeSpan = orleansSignalOptions.Value.ClientTimeoutInterval; | ||
|
||
if (globalHubOptions.Value.ClientTimeoutInterval.HasValue && | ||
timeSpan > globalHubOptions.Value.ClientTimeoutInterval) | ||
timeSpan = globalHubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
if (hubOptions.Value.ClientTimeoutInterval.HasValue && timeSpan > hubOptions.Value.ClientTimeoutInterval) | ||
timeSpan = hubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
return timeSpan; | ||
} | ||
|
||
|
||
public static TimeSpan GetClientTimeoutInterval(IOptions<HubOptions> globalHubOptions, | ||
IOptions<HubOptions> hubOptions) | ||
{ | ||
var timeSpan = TimeSpan.FromSeconds(15); | ||
|
||
if (globalHubOptions.Value.ClientTimeoutInterval.HasValue && | ||
timeSpan > globalHubOptions.Value.ClientTimeoutInterval) | ||
timeSpan = globalHubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
if (hubOptions.Value.ClientTimeoutInterval.HasValue && timeSpan > hubOptions.Value.ClientTimeoutInterval) | ||
timeSpan = hubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
return timeSpan; | ||
} | ||
|
||
public static TimeSpan GetKeepAliveInterval(IOptions<HubOptions> globalHubOptions, IOptions<HubOptions> hubOptions) | ||
{ | ||
var timeSpan = TimeSpan.FromSeconds(15); | ||
|
||
if (globalHubOptions.Value.ClientTimeoutInterval.HasValue) | ||
timeSpan = globalHubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
if (hubOptions.Value.ClientTimeoutInterval.HasValue) | ||
timeSpan = hubOptions.Value.ClientTimeoutInterval.Value; | ||
|
||
return timeSpan; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.