Skip to content

Commit

Permalink
release-app
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Feb 19, 2025
1 parent 40f15b4 commit 4327fac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
32 changes: 4 additions & 28 deletions screenpipe-app-tauri/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,10 @@ export default function Home() {
// staggered polling with exponential backoff while maintaining responsiveness
// while reducing backend load
useEffect(() => {
let retries = 0;
const maxRetries = 5;
const minDelay = 1000; // 1s minimum
const maxDelay = 30000; // 30s maximum
let timeoutId: NodeJS.Timeout;

const loadUserWithBackoff = async () => {
if (!settings.user?.token) return;

try {
await loadUser(settings.user.token, false);
retries = 0;
} catch (err) {
console.error("failed to load user:", err);
retries = Math.min(retries + 1, maxRetries);
}

// calculate next delay with exponential backoff
const delay = Math.min(minDelay * Math.pow(2, retries), maxDelay);
timeoutId = setTimeout(loadUserWithBackoff, delay);
};

loadUserWithBackoff();

// cleanup
return () => {
if (timeoutId) clearTimeout(timeoutId);
};
const interval = setInterval(() => {
loadUser(settings.user?.token!);
}, 1000);
return () => clearInterval(interval);
}, [settings]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
version = "0.34.8"
version = "0.34.9"
description = ""
authors = ["you"]
license = ""
Expand Down

0 comments on commit 4327fac

Please sign in to comment.