Skip to content

Commit

Permalink
Optimizations and corrections for Json output
Browse files Browse the repository at this point in the history
  • Loading branch information
spaghettidba committed Feb 23, 2023
1 parent 0ac72d5 commit 9c771ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions XESmartTarget.Core/Responses/OutputStreamAppenderResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ protected void Write()
{
lock (EventsTable)
{
if (EventsTable.Rows.Count == 0)
{
return;
}
lock (Lock)
{
if (_outputFormat == OutputFormatEnum.Json)
Expand Down
7 changes: 6 additions & 1 deletion XESmartTarget.Core/Utils/DataTableJsonAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ public DataTableJsonAdapter(DataTable eventsTable)

public void WriteToStream(TextWriter writer)
{
if(Table.Rows.Count == 0)
{
return;
}

var converter = new ExpandoObjectConverter();
var minifier = new JsMinifier();

if (OutputColumns != null)
{
Table = Table.DefaultView.ToTable(false, OutputColumns);
Table = Table.DefaultView.ToTable(false, OutputColumns.Where(c => Table.Columns.Contains(c)).ToArray());
}

List<Object> outputList = null;
Expand Down

0 comments on commit 9c771ae

Please sign in to comment.