YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
optimize API calls (#1431)
neo773edb3bc0d1563
diff --git a/screenpipe-app-tauri/app/page.tsx b/screenpipe-app-tauri/app/page.tsxindex 34fa4954d..daaf5dbe6 100644--- a/screenpipe-app-tauri/app/page.tsx+++ b/screenpipe-app-tauri/app/page.tsx@@ -36,11 +36,10 @@ export default function Home() {// staggered polling with exponential backoff while maintaining responsiveness// while reducing backend loaduseEffect(() => {- const interval = setInterval(() => {- loadUser(settings.user?.token!);- }, 1000);- return () => clearInterval(interval);- }, [settings]);+ if (settings.user?.token) {+ loadUser(settings.user.token);+ }+ }, [settings.user.token]);useEffect(() => {const getAudioDevices = async () => {diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsxindex 506c3d6ac..b3a27996e 100644--- a/screenpipe-app-tauri/components/pipe-store.tsx+++ b/screenpipe-app-tauri/components/pipe-store.tsx@@ -30,6 +30,7 @@ import {TooltipProvider,TooltipTrigger,} from "@/components/ui/tooltip";+import localforage from "localforage";const corePipes: string[] = ["data-table", "search"];@@ -106,20 +107,6 @@ export const PipeStore: React.FC = () => {const installedPipe = installedPipes.find((p) => p.config?.id === plugin.id,);- const currentVersion = installedPipe?.config?.version;-- let has_update = false;- if (currentVersion) {- try {- const updateCheck = await pipeApi.checkUpdate(- plugin.id,- currentVersion,- );- has_update = updateCheck.has_update;- } catch (error) {- console.error(`Failed to check updates for ${plugin.id}:`, error);- }- }return {...plugin,@@ -130,7 +117,7 @@ export const PipeStore: React.FC = () => {),is_core_pipe: corePipes.includes(plugin.name),is_enabled: installedPipe?.config?.enabled ?? false,- has_update,+ has_update: false,};}),);@@ -904,7 +891,7 @@ export const PipeStore: React.FC = () => {useEffect(() => {fetchPurchaseHistory();- }, [settings.user]);+ }, [settings.user.token]);useEffect(() => {fetchInstalledPipes();@@ -917,6 +904,43 @@ export const PipeStore: React.FC = () => {return () => clearInterval(interval);}, []);+ useEffect(() => {+ const checkForUpdates = async () => {+ if(!settings.user.token){+ return;+ }+ // Get last check time from local storage+ const lastCheckTime = await localforage.getItem<number>('lastUpdateCheck');+ const now = Date.now();++ // Check if 5 minutes have passed since last check+ if (lastCheckTime && now - lastCheckTime < 5 * 60 * 1000) {+ return;+ }++ // Store current time as last check+ await localforage.setItem('lastUpdateCheck', now);++ const installedPipes = pipes.filter((pipe) => pipe.is_installed);++ const storeApi = await PipeApi.create(settings.user.token);+ for (const pipe of installedPipes) {+ const update = await storeApi.checkUpdate(pipe.id, pipe.installed_config?.version!);+ if (update.has_update) {+ await handleUpdatePipe(pipe);+ }+ }+ };++ // Run check immediately+ checkForUpdates();++ // Set up interval to check every 5 minutes+ const interval = setInterval(checkForUpdates, 5 * 60 * 1000);++ return () => clearInterval(interval);+ }, []);+useEffect(() => {const setupDeepLink = async () => {const unsubscribeDeepLink = await onOpenUrl(async (urls) => {diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex 5e0f5a60d..cbe6f41c2 100755--- a/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -5289,7 +5289,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "0.34.7"+version = "0.35.7"dependencies = ["anyhow","async-stream",