feat: add worker sync events

Add a worker sync event so that runtime updates on one worker can propagate across other workers using pubsub for multi worker deployments
This commit is contained in:
Abhishek Kumar 2026-04-04 14:26:47 +05:30
parent 56763a4527
commit 03df5595c3
18 changed files with 446 additions and 113 deletions

View file

@ -1,6 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import {
@ -12,8 +12,10 @@ import type { LangfuseCredentialsResponse } from "@/client/types.gen";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { useAuth } from "@/lib/auth";
export function TelemetrySection() {
const { user, loading: authLoading } = useAuth();
const [credentials, setCredentials] = useState<LangfuseCredentialsResponse>({
host: "",
public_key: "",
@ -22,10 +24,15 @@ export function TelemetrySection() {
});
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
const hasFetched = useRef(false);
useEffect(() => {
if (authLoading || !user || hasFetched.current) {
return;
}
hasFetched.current = true;
fetchCredentials();
}, []);
}, [authLoading, user]);
async function fetchCredentials() {
try {

View file

@ -398,6 +398,10 @@ export function AppSidebar() {
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={() => router.push("/settings")} className="cursor-pointer">
<Settings className="mr-2 h-4 w-4" />
Platform Settings
</DropdownMenuItem>
<DropdownMenuItem onClick={() => logout()} className="cursor-pointer">
<LogOut className="mr-2 h-4 w-4" />
Sign out
@ -443,6 +447,10 @@ export function AppSidebar() {
<Settings className="mr-2 h-4 w-4" />
Account settings
</DropdownMenuItem>
<DropdownMenuItem onClick={() => router.push("/settings")} className="cursor-pointer">
<Settings className="mr-2 h-4 w-4" />
Platform Settings
</DropdownMenuItem>
<DropdownMenuItem onClick={() => router.push("/usage")} className="cursor-pointer">
<CircleDollarSign className="mr-2 h-4 w-4" />
Usage