Skip to content

Commit

Permalink
Adjusted the caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
uncheckederror committed Aug 15, 2024
1 parent e1ae7ca commit 93e97be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions NumberSearch.Mvc/Controllers/CartAPIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.OutputCaching;

using NumberSearch.DataAccess;
using NumberSearch.DataAccess.BulkVS;
Expand Down Expand Up @@ -37,6 +38,8 @@ public CartAPIController(MvcConfiguration mvcConfiguration)
public record BulkLookupResult(string DialedNumber, string City, string State, DateTime DateIngested, bool Wireless, bool Portable, DateTime LastPorted, string SPID, string LATA, string LEC, string LECType, string LIDBName, string LRN, string OCN, string CarrierName, string CarrierLogoLink);

[HttpGet("Number/Search/Bulk")]
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[OutputCache(Duration = 0)]
public async Task<IActionResult> NumberSearchBulkAsync(string token, string dialedNumber)
{
if (!string.IsNullOrWhiteSpace(token) && token == "Memorable8142024")
Expand All @@ -51,11 +54,10 @@ public async Task<IActionResult> NumberSearchBulkAsync(string token, string dial
return BadRequest("No dialed phone numbers found. Please try a different query. 🥺👉👈");
}

var lookup = new LookupController(_configuration);

var results = new List<PortedPhoneNumber>();
await Parallel.ForEachAsync(parsedNumbers, async (number, token) =>
{
var lookup = new LookupController(_configuration);
var result = await lookup.VerifyPortabilityAsync(number);
results.Add(result);
});
Expand Down

0 comments on commit 93e97be

Please sign in to comment.