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
release-app calm down posthog
Louis Beaumont4214e101bfdd
diff --git a/screenpipe-app-tauri/lib/hooks/use-health-check.tsx b/screenpipe-app-tauri/lib/hooks/use-health-check.tsxindex c9a2e0f4b..9b83ba4d6 100644--- a/screenpipe-app-tauri/lib/hooks/use-health-check.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-health-check.tsx@@ -41,6 +41,23 @@ interface HealthCheckHook {debouncedFetchHealth: () => Promise<void>;}+const POSTHOG_RATE_LIMIT_HOURS = 1; // adjust this value as needed++function shouldSendPosthogEvent(eventName: string): boolean {+ const lastSentKey = `last_posthog_${eventName}`;+ const lastSent = localStorage.getItem(lastSentKey);+ const now = Date.now();++ if (+ !lastSent ||+ now - parseInt(lastSent) > POSTHOG_RATE_LIMIT_HOURS * 60 * 60 * 1000+ ) {+ localStorage.setItem(lastSentKey, now.toString());+ return true;+ }+ return false;+}+export function useHealthCheck() {const [health, setHealth] = useState<HealthCheckResponse | null>(null);const [isServerDown, setIsServerDown] = useState(false);@@ -67,16 +84,21 @@ export function useHealthCheck() {});if (!response.ok) {- posthog.capture("health_check_http_error", {- status: response.status,- statusText: response.statusText,- });+ if (shouldSendPosthogEvent("health_check_http_error")) {+ posthog.capture("health_check_http_error", {+ status: response.status,+ statusText: response.statusText,+ });+ }throw new Error(`HTTP error! status: ${response.status}`);}const data: HealthCheckResponse = await response.json();- if (data.status === "unhealthy") {+ if (+ data.status === "unhealthy" &&+ shouldSendPosthogEvent("health_check_unhealthy")+ ) {posthog.capture("health_check_unhealthy", {frame_status: data.frame_status,audio_status: data.audio_status,@@ -96,11 +118,13 @@ export function useHealthCheck() {return;}- if (!isServerDown) {+ if (!isServerDown && shouldSendPosthogEvent("health_check_server_down")) {posthog.capture("health_check_server_down", {error: error instanceof Error ? error.message : "Unknown error",});- setIsServerDown(true);+ }++ if (!isServerDown) {const errorHealth: HealthCheckResponse = {last_frame_timestamp: null,last_audio_timestamp: null,diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 64c7fb052..cc3f30abc 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "0.30.5"+version = "0.30.6"description = ""authors = ["you"]license = ""