From 2b48f63838047aa4f2a9571fd743bc0fd13e7587 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:21:11 +0100 Subject: [PATCH 1/8] fix(ceremony): reduce by half --- ceremony/src/lib/state/contributor.svelte.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ceremony/src/lib/state/contributor.svelte.ts b/ceremony/src/lib/state/contributor.svelte.ts index 21ed289f19..34cee50007 100644 --- a/ceremony/src/lib/state/contributor.svelte.ts +++ b/ceremony/src/lib/state/contributor.svelte.ts @@ -67,8 +67,8 @@ type QueueInfoResult = QueueInfoSuccess | QueueInfoError const second = 1000 const CLIENT_POLING_INTERVAL = second * 5 -const CONTRIBUTION_POLLING_INTERVAL = second * 15 -const QUEUE_POLLING_INTERVAL = second * 30 +const CONTRIBUTION_POLLING_INTERVAL = second * 30 +const QUEUE_POLLING_INTERVAL = second * 60 export class Contributor { userId = $state(undefined) From fc018032b830b9c525ebdc05ee3733a78e58c9aa Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:26:47 +0100 Subject: [PATCH 2/8] fix(ceremony): reduce refresh --- ceremony/src/lib/supabase/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceremony/src/lib/supabase/client.ts b/ceremony/src/lib/supabase/client.ts index 20f2f9ebcc..ab5bc14703 100644 --- a/ceremony/src/lib/supabase/client.ts +++ b/ceremony/src/lib/supabase/client.ts @@ -7,7 +7,7 @@ const SUPABASE_URL = import.meta.env.VITE_SUPABASE_URL export const createSupabaseClient = () => { let client: SupabaseClient | null = null let refreshInterval: NodeJS.Timeout | null = null - const REFRESH_INTERVAL = 5 * 60 * 1000 // 5 minutes + const REFRESH_INTERVAL = 30 * 60 * 1000 // 30 minutes const getClient = () => { if (client) return client From 360fa7816472a60317ccd8535e6cd640c7930734 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:28:08 +0100 Subject: [PATCH 3/8] fix(ceremony): dont subscribe to logs from layout --- ceremony/src/lib/components/Terminal/Activity.svelte | 10 +++++++--- ceremony/src/lib/state/index.svelte.ts | 3 --- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ceremony/src/lib/components/Terminal/Activity.svelte b/ceremony/src/lib/components/Terminal/Activity.svelte index 8bc027e568..64e344a1d6 100644 --- a/ceremony/src/lib/components/Terminal/Activity.svelte +++ b/ceremony/src/lib/components/Terminal/Activity.svelte @@ -1,8 +1,12 @@ -{#if activity.data} +{#if activity && activity.data}
{#each activity.data as item, i (item)} {@const type = item.message.type} diff --git a/ceremony/src/lib/state/index.svelte.ts b/ceremony/src/lib/state/index.svelte.ts index c7fd82458a..aa64776477 100644 --- a/ceremony/src/lib/state/index.svelte.ts +++ b/ceremony/src/lib/state/index.svelte.ts @@ -2,13 +2,11 @@ import { getContext, setContext } from "svelte" import { Contributor } from "./contributor.svelte.ts" import { Terminal } from "./terminal.svelte.ts" import { user, type UserSession } from "$lib/state/session.svelte.ts" -import { Activity } from "$lib/state/live.svelte.ts" import { Contributions } from "$lib/state/contributions.svelte.ts" export interface AppState { contributor: Contributor terminal: Terminal - activity: Activity contributions: Contributions user: UserSession } @@ -20,7 +18,6 @@ export function createState() { const state: AppState = { contributor: new Contributor(), terminal: new Terminal(), - activity: new Activity(), contributions: new Contributions(), user: user } From 6446496ad696cb311177508311132df1e9dbf833 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:37:59 +0100 Subject: [PATCH 4/8] fix(ceremony): dont sub to contributions in layout --- .../components/Terminal/Contributors.svelte | 58 ++++++++++--------- ceremony/src/lib/state/index.svelte.ts | 3 - 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/ceremony/src/lib/components/Terminal/Contributors.svelte b/ceremony/src/lib/components/Terminal/Contributors.svelte index 8c2d89da50..3556bcd3ce 100644 --- a/ceremony/src/lib/components/Terminal/Contributors.svelte +++ b/ceremony/src/lib/components/Terminal/Contributors.svelte @@ -1,34 +1,38 @@ - trigger(value)} -/> + trigger(value)}/> diff --git a/ceremony/src/lib/state/index.svelte.ts b/ceremony/src/lib/state/index.svelte.ts index aa64776477..6c3f05f410 100644 --- a/ceremony/src/lib/state/index.svelte.ts +++ b/ceremony/src/lib/state/index.svelte.ts @@ -2,12 +2,10 @@ import { getContext, setContext } from "svelte" import { Contributor } from "./contributor.svelte.ts" import { Terminal } from "./terminal.svelte.ts" import { user, type UserSession } from "$lib/state/session.svelte.ts" -import { Contributions } from "$lib/state/contributions.svelte.ts" export interface AppState { contributor: Contributor terminal: Terminal - contributions: Contributions user: UserSession } @@ -18,7 +16,6 @@ export function createState() { const state: AppState = { contributor: new Contributor(), terminal: new Terminal(), - contributions: new Contributions(), user: user } From a86c336a782fde9d4d4a8e67220c43b582087f75 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:38:20 +0100 Subject: [PATCH 5/8] fix(ceremony): rename and clean up --- ceremony/src/lib/components/Terminal/Activity.svelte | 11 +++++++++-- .../lib/state/{live.svelte.ts => activity.svelte.ts} | 0 2 files changed, 9 insertions(+), 2 deletions(-) rename ceremony/src/lib/state/{live.svelte.ts => activity.svelte.ts} (100%) diff --git a/ceremony/src/lib/components/Terminal/Activity.svelte b/ceremony/src/lib/components/Terminal/Activity.svelte index 64e344a1d6..872400ba5d 100644 --- a/ceremony/src/lib/components/Terminal/Activity.svelte +++ b/ceremony/src/lib/components/Terminal/Activity.svelte @@ -1,13 +1,20 @@ trigger(value)}/> From d8c05a06a4c8c40abc51a854785b362eefe0e5ba Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:47:49 +0100 Subject: [PATCH 7/8] fix(ceremony): reduce batch size --- ceremony/src/lib/state/activity.svelte.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceremony/src/lib/state/activity.svelte.ts b/ceremony/src/lib/state/activity.svelte.ts index cdb1315d9e..7923e448a0 100644 --- a/ceremony/src/lib/state/activity.svelte.ts +++ b/ceremony/src/lib/state/activity.svelte.ts @@ -19,7 +19,7 @@ export class Activity { .from("log") .select("message, created_at") .order("created_at", { ascending: false }) - .limit(100) + .limit(50) if (error) { console.error("Error fetching initial data:", error) From 7868e11f2900fce540cf9a7a633202549a153f70 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 30 Oct 2024 09:51:23 +0100 Subject: [PATCH 8/8] fix(ceremony): lint --- ceremony/src/lib/components/Terminal/Contributors.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceremony/src/lib/components/Terminal/Contributors.svelte b/ceremony/src/lib/components/Terminal/Contributors.svelte index 40a3d4f9bf..f48fdc0bdf 100644 --- a/ceremony/src/lib/components/Terminal/Contributors.svelte +++ b/ceremony/src/lib/components/Terminal/Contributors.svelte @@ -10,7 +10,7 @@ const { terminal } = getState() let contributions: Contributions | null = null let data: Array<{ text: string; action: string }> = $state([]) -onMount(async () => { +onMount(() => { contributions = new Contributions() })