Skip to content

Commit

Permalink
Fixed bug in MySqlFunctionStore's bulk-insertion method
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed Oct 20, 2024
1 parent 2924fc4 commit 7ffbbc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ protected async Task BulkScheduleInsertsAllFunctionsSuccessfully(Task<IFunctionS
.ToList();

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

var eligibleFunctions =
Expand All @@ -1105,6 +1105,13 @@ await store.BulkScheduleFunctions(
{
eligibleFunctions.Any(f => f.FlowId == flowId).ShouldBeTrue();
}

foreach (var id in functionIds)
{
var sf = await store.GetFunction(id);
sf.ShouldNotBeNull();
sf.Parameter!.ToStringFromUtf8Bytes().ShouldBe(id.ToString());
}
}

public abstract Task DifferentTypesAreFetchedByGetExpiredFunctionsCall();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ INSERT IGNORE INTO {_tablePrefix}
var rows = new List<string>();
foreach (var ((type, instance), param) in functionsWithParam)
{
var row = $"('{type.Value.EscapeString()}', '{instance.Value.EscapeString()}', {(param == null ? "NULL" : $"'0x{Convert.ToHexString(param)}'")}, {(int) Status.Postponed}, 0, 0, {now})";
var row = $"('{type.Value.EscapeString()}', '{instance.Value.EscapeString()}', {(param == null ? "NULL" : $"x'{Convert.ToHexString(param)}'")}, {(int) Status.Postponed}, 0, 0, {now})";
rows.Add(row);
}
var rowsSql = string.Join(", " + Environment.NewLine, rows);
Expand Down

0 comments on commit 7ffbbc8

Please sign in to comment.