Skip to content

Commit

Permalink
More work in support of #438.
Browse files Browse the repository at this point in the history
  • Loading branch information
uncheckederror committed Apr 19, 2024
1 parent fc52cc3 commit 315df64
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Messaging/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ public static async Task<Results<Ok<string>, NotFound<string>, BadRequest<string
{
string dialedNumber = asDialedNumber.Type is not PhoneNumbersNA.NumberType.ShortCode ? $"1{asDialedNumber.DialedNumber}" : asDialedNumber.DialedNumber;

var existingRegistration = await db.ClientRegistrations.Where(x => x.AsDialed == asDialedNumber.DialedNumber).FirstOrDefaultAsync();
var existingRegistration = await db.ClientRegistrations.Where(x => x.AsDialed == asDialedNumber.DialedNumber).AsNoTracking().FirstOrDefaultAsync();

if (existingRegistration is not null && existingRegistration.AsDialed == asDialedNumber.DialedNumber)
{
Expand All @@ -904,11 +904,11 @@ public static async Task<Results<Ok<string>, NotFound<string>, BadRequest<string
if (result.Result is Ok<SendMessageResponse> okResult && okResult.Value is not null)
{
// Wait for a while while the message round trips? We have 30 seconds before a time out so we'll check after 1+2+3+5+10 secounds before failing.
int[] delays = [1000, 2000, 3000, 5000, 10000];
int[] delays = [10000,10000,5000,3000,2000];
foreach (var delay in delays)
{
await Task.Delay(delay);
existingRegistration = await db.ClientRegistrations.Where(x => x.AsDialed == asDialedNumber.DialedNumber).FirstOrDefaultAsync();
existingRegistration = await db.ClientRegistrations.Where(x => x.AsDialed == asDialedNumber.DialedNumber).AsNoTracking().FirstOrDefaultAsync();
if (existingRegistration is not null && existingRegistration.DateLastTestMessageReceived >= dateTestSent)
{
return TypedResults.Ok($"Registration was found for {asDialed} and inbound and outbound SMS messaging is working correctly as of {existingRegistration.DateLastTestMessageReceived}.");
Expand Down

0 comments on commit 315df64

Please sign in to comment.