refactor(executor): use action.ConfigSchema directly + dispose transient JsonDocuments
This commit is contained in:
@@ -254,7 +254,7 @@ public sealed class Executor
|
||||
JsonElement coercedConfig;
|
||||
try
|
||||
{
|
||||
coercedConfig = CoerceToSchema(templatedConfig, _nodes.Get(node.TypeId).ConfigSchema);
|
||||
coercedConfig = CoerceToSchema(templatedConfig, action.ConfigSchema);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -350,7 +350,8 @@ public sealed class Executor
|
||||
}
|
||||
w.WriteEndObject();
|
||||
}
|
||||
return JsonDocument.Parse(buffer.ToArray()).RootElement.Clone();
|
||||
using var doc = JsonDocument.Parse(buffer.ToArray());
|
||||
return doc.RootElement.Clone();
|
||||
}
|
||||
|
||||
private static string? TypeOf(JsonElement schema)
|
||||
@@ -374,7 +375,7 @@ public sealed class Executor
|
||||
var buffer = new System.IO.MemoryStream();
|
||||
using (var writer = new Utf8JsonWriter(buffer))
|
||||
WriteInterpolated(source, input, writer);
|
||||
var doc = JsonDocument.Parse(buffer.ToArray());
|
||||
using var doc = JsonDocument.Parse(buffer.ToArray());
|
||||
return doc.RootElement.Clone();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user