Skip to content

Commit 82d25fe

Browse files
committed
Fix busy indicator timeout
1 parent 2fb14be commit 82d25fe

File tree

4 files changed

+187
-98
lines changed

4 files changed

+187
-98
lines changed

src/Bible.Alarm/Common/ViewHelpers/CollectionViewHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ private static async Task<bool> CanSafelyScrollAsync(MauiCollectionView collecti
9999
/// <summary>
100100
/// Waits for a ViewModel's IsBusy property to become false using Polly retry policy.
101101
/// This is useful for ensuring data is loaded before attempting to scroll to an item.
102+
/// Default timeout is 10 seconds to allow for slower operations while preventing indefinite spinning.
102103
/// </summary>
103-
public static async Task<bool> WaitForNotBusyAsync(Func<bool> isBusyGetter, int maxWaitSeconds = 5, int delayMs = 100, CancellationToken cancellationToken = default)
104+
public static async Task<bool> WaitForNotBusyAsync(Func<bool> isBusyGetter, int maxWaitSeconds = 10, int delayMs = 100, CancellationToken cancellationToken = default)
104105
{
105106
if (isBusyGetter == null)
106107
{

src/Bible.Alarm/ViewModels/ScheduleViewModel.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,13 @@ public void OnContentLoaded()
428428
}
429429

430430
/// <summary>
431-
/// Starts a timeout task that will hide the overlay after 5 seconds if containers haven't signaled ready.
431+
/// Hard timeout in milliseconds for the busy overlay.
432+
/// After this time, the overlay will be hidden regardless of container readiness.
433+
/// </summary>
434+
private const int OverlayHardTimeoutMs = 10000; // 10 seconds
435+
436+
/// <summary>
437+
/// Starts a timeout task that will hide the overlay after 15 seconds if containers haven't signaled ready.
432438
/// This prevents the spinner from spinning forever if a container fails to signal ready.
433439
/// </summary>
434440
private void StartOverlayTimeout()
@@ -443,14 +449,14 @@ private void StartOverlayTimeout()
443449
{
444450
try
445451
{
446-
await Task.Delay(5000, token); // Wait 5 seconds
452+
await Task.Delay(OverlayHardTimeoutMs, token);
447453

448454
if (!token.IsCancellationRequested)
449455
{
450456
var stateValue = state.Value;
451457
if (stateValue.IsSchedulePageOverlayVisible && !stateValue.ContainerReadiness.AllReady)
452458
{
453-
logger.Warning("ScheduleViewModel: Overlay timeout - containers didn't signal ready within 5 seconds, hiding overlay anyway");
459+
logger.Warning("ScheduleViewModel: Overlay timeout - containers didn't signal ready within {TimeoutMs}ms, hiding overlay anyway", OverlayHardTimeoutMs);
454460
dispatcher.Dispatch(new global::Bible.Alarm.Stores.Actions.SetSchedulePageOverlayAction { IsVisible = false });
455461
}
456462
}

0 commit comments

Comments
 (0)