-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: Cleanup C# and Kotlin code
- Loading branch information
1 parent
92cb833
commit d367dde
Showing
29 changed files
with
593 additions
and
553 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
266 changes: 109 additions & 157 deletions
266
agent/dotnet/src/Perper/Application/PerperStartupExtensions.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
48 changes: 0 additions & 48 deletions
48
agent/dotnet/src/Perper/Extensions/CacheServiceExtensions.cs
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
agent/dotnet/src/Perper/Extensions/FabricServiceExtensions.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,48 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Threading.Tasks; | ||
|
||
using Perper.Model; | ||
using Perper.Protocol; | ||
|
||
namespace Perper.Extensions | ||
{ | ||
public static class FabricServiceExtensions | ||
{ | ||
public static Task WriteStreamItem<T>(this FabricService fabricService, string stream, T item, bool keepBinary = false) | ||
{ | ||
return fabricService.WriteStreamItem(stream, FabricService.CurrentTicks, item, keepBinary); | ||
} | ||
|
||
[SuppressMessage("Design", "CA1031: Do not catch general exception types", Justification = "Exception is logged/handled through other means; rethrowing from handler will crash whole application.")] | ||
public static async Task WriteExecutionResultTask(this FabricService fabricService, string call, Task<object?[]> task) | ||
{ | ||
try | ||
{ | ||
var result = await task.ConfigureAwait(false); | ||
await fabricService.WriteExecutionResult(call, result).ConfigureAwait(false); | ||
} | ||
catch (Exception exception) | ||
{ | ||
await fabricService.WriteExecutionException(call, exception).ConfigureAwait(false); | ||
} | ||
} | ||
|
||
public static Task WriteExecutionException(this FabricService fabricService, string call, Exception exception) | ||
{ | ||
return fabricService.WriteExecutionError(call, exception.Message); | ||
} | ||
|
||
public static async Task<object?[]?> ReadExecutionResult(this FabricService fabricService, string call) | ||
{ | ||
var (error, result) = await fabricService.ReadExecutionErrorAndResult(call).ConfigureAwait(false); | ||
|
||
if (error != null) | ||
{ | ||
throw new InvalidOperationException($"Execution failed with error: {error}"); | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
} |
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.