-
-
Notifications
You must be signed in to change notification settings - Fork 75
Feature/prevent blocking start async #1303
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
Open
DevJasperNL
wants to merge
12
commits into
net-daemon:main
Choose a base branch
from
DevJasperNL:feature/prevent_blocking_StartAsync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
908bb41
Removing blocking logic from NetDaemonRuntime.
DevJasperNL 4c588b5
Changing StartAsync to Start as it doesn't do any async work itself a…
DevJasperNL 19a5f14
Updated NetDaemonRuntimeTests and updated TestOnConnectError to refle…
DevJasperNL c85ee7c
Adding method that blocks until connection to home assistant is estab…
DevJasperNL d576dc0
Adding logic to wait for cache to be initialized.
DevJasperNL bad7612
Changing test name.
DevJasperNL b5e4716
Exposing INetDaemonRuntimeInitializedCheck and implementing its use f…
DevJasperNL 9fdc72b
Cleanup of unused extension method.
DevJasperNL 8d95e98
TaskCompletionSource<object?> -> TaskCompletionSource
DevJasperNL cd9f387
Implementing EnsureInitializedAsync and renaming IRuntime to INetDaem…
DevJasperNL cf48fc3
Added behavior for unauthorized disconnect.
DevJasperNL 3ab4e9d
Adding xml comment for enum
DevJasperNL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
17 changes: 17 additions & 0 deletions
17
src/Runtime/NetDaemon.Runtime/Common/AutoReconnectOptions.cs
This file contains hidden or 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,17 @@ | ||
namespace NetDaemon.Runtime; | ||
|
||
/// <summary> | ||
/// Enum to determine the auto reconnect behavior of the runtime. | ||
/// </summary> | ||
public enum AutoReconnectOptions | ||
{ | ||
/// <summary> | ||
/// Will stop automatically reconnecting if the Home Assistant server returns an Unauthorized response. This prevents the user from being locked out of the Home Assistant server. This is the default behavior. | ||
/// </summary> | ||
StopReconnectOnUnAuthorized, | ||
|
||
/// <summary> | ||
/// Will always attempt to reconnect to the Home Assistant server. | ||
/// </summary> | ||
AlwaysAttemptReconnect | ||
} |
This file contains hidden or 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 hidden or 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,20 @@ | ||
namespace NetDaemon.Runtime; | ||
|
||
/// <summary> | ||
/// The NetDaemon runtime interface. | ||
/// </summary> | ||
public interface INetDaemonRuntime : IAsyncDisposable | ||
{ | ||
/// <summary> | ||
/// Starts the runtime and passes <paramref name="stoppingToken"/> to the runtime task/thread. | ||
/// Will return a task that completes when the NetDaemon runtime is initialized. | ||
/// | ||
/// Calling this method multiple times will only start the runtime once, but can be useful for other processes if they want to await the NetDaemon runtime to be initialized. | ||
/// </summary> | ||
Task EnsureInitializedAsync(CancellationToken stoppingToken = default); | ||
|
||
/// <summary> | ||
/// Determines auto reconnect behavior of the runtime. | ||
/// </summary> | ||
AutoReconnectOptions AutoReconnectOptions { get; set; } | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was important since we needed the NetDaemon not to retry connection if it was unauthorized. It should just log and think it is connected. It is a hacky way of doing ti when I see it now but that feature is needed not to make user account locked etc. Unless you handle this somewhere else in the code and I fail to see it.