Use a stream instead of putting the entire string in memory
This commit is contained in:
@@ -52,7 +52,7 @@ namespace AS1024.GeoFeed.Core.GeoFeedProviders
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
string stringResult = await result.Content.ReadAsStringAsync();
|
var stringResult = await result.Content.ReadAsStreamAsync();
|
||||||
jsonData = DeserializeJsonData(stringResult);
|
jsonData = DeserializeJsonData(stringResult);
|
||||||
|
|
||||||
if (jsonData?.Results == null || jsonData.Results.Count == 0)
|
if (jsonData?.Results == null || jsonData.Results.Count == 0)
|
||||||
@@ -93,7 +93,7 @@ namespace AS1024.GeoFeed.Core.GeoFeedProviders
|
|||||||
return geoFeed;
|
return geoFeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual NetboxData? DeserializeJsonData(string stringResult)
|
protected virtual NetboxData? DeserializeJsonData(Stream stringResult)
|
||||||
{
|
{
|
||||||
return JsonSerializer.Deserialize<NetboxData>(stringResult, new JsonSerializerOptions
|
return JsonSerializer.Deserialize<NetboxData>(stringResult, new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user