Skip to content

Commit

Permalink
Update MauiProgram.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
brminnick committed Apr 5, 2023
1 parent 5c9aec5 commit 478ac1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HackerNews/MauiProgram.cs
Expand Up @@ -29,14 +29,14 @@ public static MauiApp CreateMauiApp()

builder.Services.AddRefitClient<IHackerNewsAPI>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri("https://hacker-news.firebaseio.com/v0"))
.AddTransientHttpErrorPolicy(builder => builder.WaitAndRetryAsync(3, sleepDurationProvider));
.AddTransientHttpErrorPolicy(builder => builder.WaitAndRetryAsync(3, ExponentialBackoff));

// Pages + View Models
builder.Services.AddTransientWithShellRoute<NewsPage, NewsViewModel>($"//{nameof(NewsPage)}");


return builder.Build();

static TimeSpan sleepDurationProvider(int attemptNumber) => TimeSpan.FromSeconds(Math.Pow(2, attemptNumber));
static TimeSpan ExponentialBackoff(int attemptNumber) => TimeSpan.FromSeconds(Math.Pow(2, attemptNumber));
}
}

0 comments on commit 478ac1c

Please sign in to comment.