Skip to content

Commit 2292cf7

Browse files
committed
Removed Await statements in Orchestrator related code
1 parent 369b85c commit 2292cf7

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

dotNet/CoreHelpers.Extensions.Logging.DurableTask/InvocationTaskLoggingMiddleware.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,27 @@ public static FunctionsApplicationBuilder UseTaskLoggingMiddleware(this Function
2121

2222
internal class InvocationTaskLoggingMiddleware : IFunctionsWorkerMiddleware
2323
{
24-
public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
24+
public Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
2525
{
2626
// figure out if it is an orchestration function
2727
bool isOrchestration = context.FunctionDefinition.InputBindings.Values
2828
.Any(b => b.Type.EndsWith("orchestrationTrigger", StringComparison.OrdinalIgnoreCase));
2929

3030
if (isOrchestration)
31-
{
32-
await next(context);
33-
}
34-
else
35-
{
36-
var logger = context.GetLogger(context.FunctionDefinition.Name);
31+
return next(context);
32+
33+
var logger = context.GetLogger(context.FunctionDefinition.Name);
3734

38-
using (logger.BeginNewTaskScope(context.FunctionDefinition.Name, "ActivityInvocation", "AzureFunctionsFlexConsumption"))
35+
using (logger.BeginNewTaskScope(context.FunctionDefinition.Name, "ActivityInvocation", "AzureFunctionsFlexConsumption"))
36+
{
37+
try
38+
{
39+
return next(context);
40+
}
41+
catch (Exception ex)
3942
{
40-
try
41-
{
42-
await next(context);
43-
}
44-
catch (Exception ex)
45-
{
46-
logger.LogError(ex, "An unhandled exception occurred during function invocation.");
47-
}
43+
logger.LogError(ex, "An unhandled exception occurred during function invocation.");
44+
throw;
4845
}
4946
}
5047
}

0 commit comments

Comments
 (0)