Skip to content

Commit 56a8424

Browse files
committed
Extract autoReloadPollIntervalMs to an env var
1 parent 6a480c1 commit 56a8424

File tree

2 files changed

+8
-2
lines changed
  • apps/webapp/app

2 files changed

+8
-2
lines changed

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,8 @@ const EnvironmentSchema = z
10311031
QUEUE_SSE_AUTORELOAD_INTERVAL_MS: z.coerce.number().int().default(5_000),
10321032
QUEUE_SSE_AUTORELOAD_TIMEOUT_MS: z.coerce.number().int().default(60_000),
10331033

1034+
DEPLOYMENTS_AUTORELOAD_POLL_INTERVAL_MS: z.coerce.number().int().default(5_000),
1035+
10341036
SLACK_BOT_TOKEN: z.string().optional(),
10351037
SLACK_SIGNUP_REASON_CHANNEL_ID: z.string().optional(),
10361038

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {
6262
import { createSearchParams } from "~/utils/searchParams";
6363
import { compareDeploymentVersions } from "~/v3/utils/deploymentVersions";
6464
import { useAutoRevalidate } from "~/hooks/useAutoRevalidate";
65+
import { env } from "~/env.server";
6566

6667
export const meta: MetaFunction = () => {
6768
return [
@@ -117,7 +118,9 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
117118
? result.deployments.find((d) => d.version === version)
118119
: undefined;
119120

120-
return typedjson({ ...result, selectedDeployment });
121+
const autoReloadPollIntervalMs = env.DEPLOYMENTS_AUTORELOAD_POLL_INTERVAL_MS;
122+
123+
return typedjson({ ...result, selectedDeployment, autoReloadPollIntervalMs });
121124
} catch (error) {
122125
console.error(error);
123126
throw new Response(undefined, {
@@ -138,14 +141,15 @@ export default function Page() {
138141
selectedDeployment,
139142
connectedGithubRepository,
140143
environmentGitHubBranch,
144+
autoReloadPollIntervalMs,
141145
} = useTypedLoaderData<typeof loader>();
142146
const hasDeployments = totalPages > 0;
143147

144148
const { deploymentParam } = useParams();
145149
const location = useLocation();
146150
const navigate = useNavigate();
147151

148-
useAutoRevalidate({ interval: 5000, onFocus: true });
152+
useAutoRevalidate({ interval: autoReloadPollIntervalMs, onFocus: true });
149153

150154
// If we have a selected deployment from the version param, show it
151155
useEffect(() => {

0 commit comments

Comments
 (0)