Skip to content

Commit

Permalink
Fixed SqlServerFunctionStore missing parent in BulkSchedule bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed Nov 30, 2024
1 parent cfa6d3c commit 7567fda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ await store.SucceedFunction(
protected async Task BulkScheduleInsertsAllFunctionsSuccessfully(Task<IFunctionStore> storeTask)
{
var store = await storeTask;

var parent = TestStoredId.Create();
var typeId = TestStoredId.Create().Type;
var functionIds = Enumerable
.Range(0, 500)
Expand All @@ -1167,7 +1167,7 @@ protected async Task BulkScheduleInsertsAllFunctionsSuccessfully(Task<IFunctionS

await store.BulkScheduleFunctions(
functionIds.Select(functionId => new IdWithParam(functionId, "humanInstanceId", Param: functionId.ToString().ToUtf8Bytes())),
parent: null
parent
);

var eligibleFunctions =
Expand All @@ -1184,6 +1184,7 @@ await store.BulkScheduleFunctions(
var sf = await store.GetFunction(id);
sf.ShouldNotBeNull();
sf.Parameter!.ToStringFromUtf8Bytes().ShouldBe(id.ToString());
sf.ParentId.ShouldBe(parent);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ AS source (
)
ON {_tableName}.FlowType = source.FlowType AND {_tableName}.flowInstance = source.flowInstance
WHEN NOT MATCHED THEN
INSERT (FlowType, FlowInstance, ParamJson, Status, Epoch, Expires, Timestamp, HumanInstanceId)
VALUES (source.FlowType, source.flowInstance, source.ParamJson, source.Status, source.Epoch, source.Expires, source.Timestamp, source.HumanInstanceId);";
INSERT (FlowType, FlowInstance, ParamJson, Status, Epoch, Expires, Timestamp, HumanInstanceId, Parent)
VALUES (source.FlowType, source.flowInstance, source.ParamJson, source.Status, source.Epoch, source.Expires, source.Timestamp, source.HumanInstanceId, source.Parent);";

var parentStr = parent == null ? "NULL" : $"'{parent}'";
var valueSql = $"(@FlowType, @FlowInstance, @ParamJson, {(int)Status.Postponed}, 0, 0, 0, @HumanInstanceId, {parentStr})";
Expand Down

0 comments on commit 7567fda

Please sign in to comment.