Stu Mason
Stu Mason

Activity

StuMason/cleanconnect
Client SaaS
TypeScript
Issue Resolved

Issue #39 closed: Optimize data export polling with exponential backoff

Background

From PR #37 review - the privacy settings page polls every 5 seconds while a data export is in progress.

Problem

  • Creates unnecessary server load
  • Fixed 5-second interval is aggressive
  • WebSocket notifications are already implemented but polling is still frequent

Suggested Implementation

Options to consider:

  1. Increase polling interval - 10-15 seconds instead of 5
  2. Exponential backoff - Start at 5s, then 10s, 20s, etc.
  3. WebSocket-only with polling fallback - Only poll if WebSocket connection fails
  4. Remove polling entirely - Rely solely on WebSocket notifications (already implemented)

Current Code

// resources/js/pages/settings/privacy.tsx
useEffect(() => {
    if (!isExportInProgress) return;

    const interval = setInterval(() => {
        router.reload({ only: ['exportStatus'] });
    }, 5000);  // <-- 5 seconds

    return () => clearInterval(interval);
}, [isExportInProgress]);

Priority

Low - Performance optimization, not a bug.

Labels

enhancement, performance