Skip to content

Commit e493ba4

Browse files
authored
Fix: Timeout request after 10s by default (#1225)
1 parent 1746a29 commit e493ba4

21 files changed

Lines changed: 716 additions & 680 deletions

File tree

web/client/openapi.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,9 @@
701701
"ApiExceptionPayload": {
702702
"properties": {
703703
"timestamp": { "type": "integer", "title": "Timestamp" },
704-
"status": { "type": "integer", "title": "Status" },
705704
"message": { "type": "string", "title": "Message" },
706705
"origin": { "type": "string", "title": "Origin" },
706+
"status": { "type": "integer", "title": "Status" },
707707
"trigger": { "type": "string", "title": "Trigger" },
708708
"type": { "type": "string", "title": "Type" },
709709
"description": { "type": "string", "title": "Description" },
@@ -715,7 +715,7 @@
715715
}
716716
},
717717
"type": "object",
718-
"required": ["timestamp", "status", "message", "origin"],
718+
"required": ["timestamp", "message", "origin"],
719719
"title": "ApiExceptionPayload"
720720
},
721721
"ApplyResponse": {
@@ -930,7 +930,13 @@
930930
},
931931
"Environment": {
932932
"properties": {
933-
"name": { "type": "string", "title": "Name" },
933+
"name": { "type": "string", "title": "Name", "default": "prod" },
934+
"suffix_target": {
935+
"allOf": [
936+
{ "$ref": "#/components/schemas/EnvironmentSuffixTarget" }
937+
],
938+
"default": "schema"
939+
},
934940
"snapshots": {
935941
"items": { "$ref": "#/components/schemas/SnapshotTableInfo" },
936942
"type": "array",
@@ -968,9 +974,15 @@
968974
},
969975
"additionalProperties": false,
970976
"type": "object",
971-
"required": ["name", "snapshots", "start_at", "plan_id"],
977+
"required": ["snapshots", "start_at", "plan_id"],
972978
"title": "Environment",
973-
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n name: The name of the environment.\n snapshots: The snapshots that are part of this environment.\n start_at: The start time of the environment.\n end_at: The end time of the environment.\n plan_id: The ID of the plan that last updated this environment.\n previous_plan_id: The ID of the previous plan that updated this enviornment.\n expiration_ts: The timestamp when this environment will expire.\n finalized_ts: The timestamp when this environment was finalized.\n promotion_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted."
979+
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n start_at: The start time of the environment.\n end_at: The end time of the environment.\n plan_id: The ID of the plan that last updated this environment.\n previous_plan_id: The ID of the previous plan that updated this environment.\n expiration_ts: The timestamp when this environment will expire.\n finalized_ts: The timestamp when this environment was finalized.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted."
980+
},
981+
"EnvironmentSuffixTarget": {
982+
"type": "string",
983+
"enum": ["schema", "table"],
984+
"title": "EnvironmentSuffixTarget",
985+
"description": "An enumeration."
974986
},
975987
"EvaluateInput": {
976988
"properties": {

web/client/src/App.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
1-
import { useEffect, useCallback, Suspense } from 'react'
1+
import { useEffect, Suspense } from 'react'
22
import { RouterProvider } from 'react-router-dom'
33
import { Divider } from '@components/divider/Divider'
44
import Header from './library/pages/root/Header'
55
import Footer from './library/pages/root/Footer'
66
import { router } from './routes'
77
import Loading from '@components/loading/Loading'
88
import Spinner from '@components/logo/Spinner'
9-
import { debounceAsync } from './utils'
109
import { useApiMeta } from './api'
1110
import { useStoreContext } from '@context/context'
1211

1312
export default function App(): JSX.Element {
1413
const setVersion = useStoreContext(s => s.setVersion)
1514

16-
const { refetch: getMeta } = useApiMeta()
17-
18-
const debouncedGetMeta = useCallback(debounceAsync(getMeta, 1000, true), [
19-
getMeta,
20-
])
15+
const { refetch: getMeta, cancel: cancelRequestMeta } = useApiMeta({
16+
debounceImmediate: true,
17+
})
2118

2219
useEffect(() => {
23-
void debouncedGetMeta().then(({ data }) => {
24-
setVersion(data?.version)
25-
})
20+
void getMeta().then(({ data }) => setVersion(data?.version))
2621

2722
return () => {
28-
debouncedGetMeta.cancel()
23+
void cancelRequestMeta()
2924
}
3025
}, [])
3126

0 commit comments

Comments
 (0)