MCPcopy Index your code
hub / github.com/coder/coder / isShutdownSoon

Function isShutdownSoon

site/src/utils/schedule.tsx:178–188  ·  view source on GitHub ↗
(workspace: Workspace)

Source from the content-addressed store, hash-verified

176};
177
178const isShutdownSoon = (workspace: Workspace): boolean => {
179 const deadline = workspace.latest_build.deadline;
180 if (!deadline) {
181 return false;
182 }
183 const deadlineDate = new Date(deadline);
184 const now = new Date();
185 const diff = deadlineDate.getTime() - now.getTime();
186 const oneHour = 1000 * 60 * 60;
187 return diff < oneHour;
188};
189
190export const deadlineExtensionMin = dayjs.duration(30, "minutes");
191export const deadlineExtensionMax = dayjs.duration(24, "hours");

Callers 1

autostopDisplayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected