Merge branch 'patch/alpha'

This commit is contained in:
Sipke Schoorstra 2024-06-07 18:01:09 +02:00
commit bcc6071644
5 changed files with 36 additions and 27 deletions

View file

@ -64,25 +64,25 @@ jobs:
else
echo "VERSION=3.2.0-${PACKAGE_PREFIX}.${{github.run_number}}" >> $GITHUB_ENV
fi
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Install SonarScanner for .NET
run: dotnet tool install --global dotnet-sonarscanner
- name: Install Coverlet for code coverage
run: dotnet tool install --global coverlet.console
- name: Begin SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner begin /k:"elsa-workflows_elsa-core" /o:"elsa-workflows" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.exclusions=**/obj/**,**/*.dll,build/**,samples/**,src/bundles/** /d:"sonar.verbose=true" /d:sonar.cs.opencover.reportsPaths=**/testresults/**/coverage.opencover.xml
# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'adopt'
# - name: Install SonarScanner for .NET
# run: dotnet tool install --global dotnet-sonarscanner
# - name: Install Coverlet for code coverage
# run: dotnet tool install --global coverlet.console
# - name: Begin SonarCloud analysis
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: dotnet sonarscanner begin /k:"elsa-workflows_elsa-core" /o:"elsa-workflows" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.exclusions=**/obj/**,**/*.dll,build/**,samples/**,src/bundles/** /d:"sonar.verbose=true" /d:sonar.cs.opencover.reportsPaths=**/testresults/**/coverage.opencover.xml
- name: Compile+Test+Pack
run: ./build.sh Compile+Test+Pack --version ${VERSION} --analyseCode true
- name: End SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
# - name: End SonarCloud analysis
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:

View file

@ -141,7 +141,8 @@ public class Flowchart : Container
var logger = context.GetRequiredService<ILogger<Flowchart>>();
var loggerScopeState = new Dictionary<string, object>
{
["ThreadId"] = Thread.CurrentThread.ManagedThreadId,
["ThreadId"] = Environment.CurrentManagedThreadId,
["TaskId"] = Task.CurrentId?.ToString() ?? "N/A",
["ActivityId"] = Id,
["ActivityInstanceId"] = context.TargetContext.Id
};
@ -174,11 +175,12 @@ public class Flowchart : Container
{
if (children.Any())
{
scope.AddActivities(children);
// Schedule each child, but only if all of its left inbound activities have already executed.
foreach (var activity in children)
{
var existingActivity = scope.ContainsActivity(activity);
scope.AddActivity(activity);
var inboundActivities = Connections.LeftInboundActivities(activity).ToList();
// If the completed activity is not part of the left inbound path, always allow its children to be scheduled.
@ -212,8 +214,13 @@ public class Flowchart : Container
if (joinContext != null)
logger.LogDebug("Next activity {ChildActivityId} is a join activity. Attaching to existing join context {JoinContext}", activity.Id, joinContext.Id);
else
else if(!existingActivity)
logger.LogDebug("Next activity {ChildActivityId} is a join activity. Creating new join context", activity.Id);
else
{
logger.LogDebug("Next activity {ChildActivityId} is a join activity. Join context was not found, but activity is already being created.", activity.Id);
continue;
}
await flowchartContext.ScheduleActivityAsync(activity, scheduleWorkOptions);
}
@ -231,7 +238,6 @@ public class Flowchart : Container
private async Task CompleteIfNoPendingWorkAsync(ActivityExecutionContext context)
{
var logger = context.GetRequiredService<ILogger<Flowchart>>();
var hasPendingWork = HasPendingWork(context);
if (!hasPendingWork)

View file

@ -45,6 +45,11 @@ internal class FlowScope
return state;
}
public bool ContainsActivity(IActivity activity)
{
return Activities.ContainsKey(activity.Id);
}
public void RegisterActivityExecution(IActivity activity)
{

View file

@ -56,9 +56,7 @@ public class WorkflowRunner(
}
/// <inheritdoc />
public async Task<TResult> RunAsync<T, TResult>(
RunWorkflowOptions? options = default,
CancellationToken cancellationToken = default) where T : WorkflowBase<TResult>, new()
public async Task<TResult> RunAsync<T, TResult>(RunWorkflowOptions? options = default, CancellationToken cancellationToken = default) where T : WorkflowBase<TResult>, new()
{
var builder = workflowBuilderFactory.CreateBuilder();
var workflow = await builder.BuildWorkflowAsync<T>(cancellationToken);

View file

@ -2,7 +2,7 @@ namespace Elsa.Workflows.ComponentTests;
public interface ISignalManager
{
Task<T> WaitAsync<T>(object signal, int millisecondsTimeout = 1000);
Task<object?> WaitAsync(object signal, int millisecondsTimeout = 1000);
Task<T> WaitAsync<T>(object signal, int millisecondsTimeout = 2000);
Task<object?> WaitAsync(object signal, int millisecondsTimeout = 2000);
void Trigger(object signal, object? result = null);
}