Skip to content

Commit

Permalink
update to use ReferenceHandler.Preserve to break circular references …
Browse files Browse the repository at this point in the history
…in serialization
  • Loading branch information
JackLewis-digirati committed Mar 1, 2024
1 parent a64e90b commit 5992e3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using DLCS.AWS.SNS;
using DLCS.Core.Collections;
using DLCS.Core.Strings;
Expand All @@ -18,7 +19,10 @@ public class AssetNotificationSender : IAssetNotificationSender
private readonly ILogger<AssetNotificationSender> logger;
private readonly ITopicPublisher topicPublisher;
private readonly IPathCustomerRepository customerPathRepository;
private readonly JsonSerializerOptions settings = new(JsonSerializerDefaults.Web);
private readonly JsonSerializerOptions settings = new(JsonSerializerDefaults.Web)
{
ReferenceHandler = ReferenceHandler.Preserve
};

private readonly Dictionary<int, CustomerPathElement> customerPathElements = new();

Expand Down
6 changes: 5 additions & 1 deletion src/protagonist/DLCS.Repository/Messaging/EngineClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using DLCS.AWS.SQS;
Expand All @@ -26,7 +27,10 @@ public class EngineClient : IEngineClient
private readonly ILogger<EngineClient> logger;
private readonly DlcsSettings dlcsSettings;

private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web);
private static readonly JsonSerializerOptions SerializerOptions = new (JsonSerializerDefaults.Web)
{
ReferenceHandler = ReferenceHandler.Preserve
};

public EngineClient(
IQueueLookup queueLookup,
Expand Down

0 comments on commit 5992e3d

Please sign in to comment.