Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix logs replication

Tomas Valentafa0d7d255d19
diff --git a/api-service/Makefile b/api-service/Makefile
index 00aed0e34..6938081de 100644
--- a/api-service/Makefile
+++ b/api-service/Makefile
@@ -8,4 +8,5 @@ generate-playground-client:
--additional-properties=disallowAdditionalPropertiesIfNotPresent=true \
--additional-properties=packageName=playground_client \
--additional-properties=floatStrictType=false \
+ --additional-properties=library=asyncio \
--additional-properties=allowStringInDateTimeParameters=false
diff --git a/components/Editor/RightSidebar/Logs/index.tsx b/components/Editor/RightSidebar/Logs/index.tsx
index ceedbdedc..1329bf05c 100644
--- a/components/Editor/RightSidebar/Logs/index.tsx
+++ b/components/Editor/RightSidebar/Logs/index.tsx
@@ -13,6 +13,19 @@ import { Database, Json } from 'db/supabase'
import { deploymentsTable } from 'db/tables'
import produce from 'immer'
+const tabsProps = {
+ tabs: [
+ {
+ label: 'Pretty',
+ id: 'pretty',
+ },
+ {
+ label: 'Raw',
+ id: 'raw',
+ },
+ ]
+}
+
export interface Props {
deployment?: deployments
}
@@ -21,18 +34,6 @@ function Logs({
deployment,
}: Props) {
const [selectedTab, setSelectedTab] = useState(0)
- const [tabsProps] = useState({
- tabs: [
- {
- label: 'Pretty',
- id: 'pretty',
- },
- {
- label: 'Raw',
- id: 'raw',
- },
- ]
- })
const client = useSupabaseClient<Database>()
const tabsCss = useTabs(tabsProps)
diff --git a/components/Tabs/useTabs.ts b/components/Tabs/useTabs.ts
index c6e6907f2..08654d0bf 100644
--- a/components/Tabs/useTabs.ts
+++ b/components/Tabs/useTabs.ts
@@ -4,10 +4,8 @@ type Tab = { label: string; id: string; }
export function useTabs({
tabs,
- onChange,
}: {
tabs: Tab[];
- onChange?: (id: string) => void
}) {
const [selectedTabIndex, setSelectedTab] = useState(-1)
@@ -15,9 +13,8 @@ export function useTabs({
tabProps: {
tabs,
selectedTabIndex,
- onChange,
setSelectedTab,
},
selectedTab: tabs[selectedTabIndex],
- }), [selectedTabIndex])
+ }), [selectedTabIndex, tabs])
}
diff --git a/hooks/useLatestDeployment.tsx b/hooks/useLatestDeployment.tsx
index 6cc8af467..f7752fb90 100644
--- a/hooks/useLatestDeployment.tsx
+++ b/hooks/useLatestDeployment.tsx
@@ -46,6 +46,11 @@ export function useLatestDeployment(project: projects, route?: Route) {
}
})
.subscribe()
+
+ // Sometimes a large field from realtime server can be missing because of the internal POSTGRES/TOAST workings.
+ // We changed the table replication to full with `ALTER TABLE events REPLICA IDENTITY FULL;` to fix this.
+ // https://github.com/supabase/realtime/issues/223 mentioned that we may need to check the `old_record` field of the payload for the actual value,
+ // but so far it seems we don't have to.
const updateSub = client.channel('any')
.on('postgres_changes',
{
diff --git a/package.json b/package.json
index 3f9cec886..bf8eacfd6 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"dev": "npx concurrently -p none \"next dev\" \"yarn start:api\" \"yarn start:playground\"",
"dev:api-service": "npx concurrently \"yarn start:api\" \"yarn start:playground\"",
"build": "next build",
- "start:api": "cd api-service && PYTHONUNBUFFERED=1 poetry run gunicorn app:app --bind 0.0.0.0:5000 -k uvicorn.workers.UvicornWorker --reload --timeout 0",
+ "start:api": "cd api-service && PYTHONUNBUFFERED=1 exec poetry run gunicorn app:app --bind 0.0.0.0:5000 -k uvicorn.workers.UvicornWorker --reload --timeout 0",
"start:playground": "cd api-service/playground && yarn dev",
"install:api-service": "cd api-service && poetry install && cd playground && yarn",
"start": "next start",