Compare commits
62
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ad82d1e02 | ||
|
|
54eaef725a | ||
|
|
2a2226456c | ||
|
|
b8d4e4fc59 | ||
|
|
24cf1ec6c8 | ||
|
|
a76f837803 | ||
|
|
9da2653d7b | ||
|
|
0092c9c006 | ||
|
|
348502834c | ||
|
|
1e007551ef | ||
|
|
07c62970b5 | ||
|
|
f0123d8052 | ||
|
|
de7d5b38ef | ||
|
|
e51a55b14d | ||
|
|
1a5e8dc77d | ||
|
|
3b9e162315 | ||
|
|
89dec1c82b | ||
|
|
1a44080b84 | ||
|
|
762615b258 | ||
|
|
f9036f0863 | ||
|
|
990f353040 | ||
|
|
37836e56b8 | ||
|
|
5e4060cfe3 | ||
|
|
c90bef4cf8 | ||
|
|
61bcae9aff | ||
|
|
aa8dec6ca1 | ||
|
|
e9bd8150fa | ||
|
|
ce2808ccbc | ||
|
|
58692f8b72 | ||
|
|
421f1635ef | ||
|
|
b9f24f290d | ||
|
|
a84cb95c50 | ||
|
|
ac6e4ded73 | ||
|
|
5a6d59576a | ||
|
|
3a34ee89d4 | ||
|
|
ba2218490b | ||
|
|
188966db49 | ||
|
|
35b10b0a23 | ||
|
|
082d44cac7 | ||
|
|
a88f5def87 | ||
|
|
033a8e6ca1 | ||
|
|
bd7016483d | ||
|
|
6bb885c98b | ||
|
|
2ca441548b | ||
|
|
53461bbb59 | ||
|
|
82ad0bee9d | ||
|
|
250793ccdd | ||
|
|
93b3cc8b68 | ||
|
|
19f7c30876 | ||
|
|
c3cfdb68a5 | ||
|
|
bad7a3c7ea | ||
|
|
4ef0ef53ed | ||
|
|
07da6ce4ce | ||
|
|
48b604bef9 | ||
|
|
f14cd68fcc | ||
|
|
b06aa07b3d | ||
|
|
1ba63985dd | ||
|
|
8968d01781 | ||
|
|
daa63e7c54 | ||
|
|
305586d55b | ||
|
|
881fbdeeb4 | ||
|
|
dd109c0e5c |
No files matched your search
@@ -8,11 +8,8 @@ import { typographyLevels } from "@/Utils/Theme/Palette";
|
|||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import { LAYOUT } from "@/Utils/Theme/constants";
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
import { formatDuration } from "@/Utils/TimeUtils";
|
import { formatDuration } from "@/Utils/TimeUtils";
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
|
|
||||||
export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t, i18n } = useTranslation();
|
|
||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
|
|
||||||
if (!monitor) {
|
if (!monitor) {
|
||||||
@@ -55,12 +52,7 @@ export const MonitorStatus = ({ monitor }: { monitor: Monitor }) => {
|
|||||||
<>
|
<>
|
||||||
<Dot />
|
<Dot />
|
||||||
<Typography>
|
<Typography>
|
||||||
{t("pages.common.monitors.statBoxes.checkingEvery", {
|
Checking every {formatDuration(monitor?.interval, true)}
|
||||||
interval: formatDuration(monitor.interval, {
|
|
||||||
long: true,
|
|
||||||
locale: i18n.resolvedLanguage,
|
|
||||||
}),
|
|
||||||
})}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import {
|
|||||||
type FieldValues,
|
type FieldValues,
|
||||||
} from "react-hook-form";
|
} from "react-hook-form";
|
||||||
import { Autocomplete } from "@/Components/inputs";
|
import { Autocomplete } from "@/Components/inputs";
|
||||||
import type { AutocompleteProps } from "@mui/material/Autocomplete";
|
|
||||||
|
|
||||||
export interface AutocompleteOption {
|
export interface AutocompleteOption {
|
||||||
id: string | number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,9 +16,6 @@ interface FormAutocompleteProps<T extends FieldValues, O extends AutocompleteOpt
|
|||||||
options: O[];
|
options: O[];
|
||||||
fieldLabel?: string;
|
fieldLabel?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
filterOptions?: AutocompleteProps<O, false, false, false>["filterOptions"];
|
|
||||||
getOptionDisabled?: AutocompleteProps<O, false, false, false>["getOptionDisabled"];
|
|
||||||
disableClearable?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FormAutocompleteField = <
|
export const FormAutocompleteField = <
|
||||||
@@ -30,9 +26,6 @@ export const FormAutocompleteField = <
|
|||||||
options,
|
options,
|
||||||
fieldLabel,
|
fieldLabel,
|
||||||
placeholder,
|
placeholder,
|
||||||
filterOptions,
|
|
||||||
getOptionDisabled,
|
|
||||||
disableClearable,
|
|
||||||
}: FormAutocompleteProps<T, O>) => {
|
}: FormAutocompleteProps<T, O>) => {
|
||||||
const { control } = useFormContext<T>();
|
const { control } = useFormContext<T>();
|
||||||
return (
|
return (
|
||||||
@@ -46,14 +39,10 @@ export const FormAutocompleteField = <
|
|||||||
isOptionEqualToValue={(option, value) => option.id === value.id}
|
isOptionEqualToValue={(option, value) => option.id === value.id}
|
||||||
value={options.find((o) => o.id === field.value) ?? null}
|
value={options.find((o) => o.id === field.value) ?? null}
|
||||||
onChange={(_: unknown, newValue: O | null) => {
|
onChange={(_: unknown, newValue: O | null) => {
|
||||||
if (newValue === null && disableClearable) return;
|
|
||||||
field.onChange(newValue?.id ?? "");
|
field.onChange(newValue?.id ?? "");
|
||||||
}}
|
}}
|
||||||
fieldLabel={fieldLabel}
|
fieldLabel={fieldLabel}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
filterOptions={filterOptions}
|
|
||||||
getOptionDisabled={getOptionDisabled}
|
|
||||||
disableClearable={disableClearable}
|
|
||||||
error={!!fieldState.error}
|
error={!!fieldState.error}
|
||||||
helperText={fieldState.error?.message ?? ""}
|
helperText={fieldState.error?.message ?? ""}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const MonitorStatBoxes = ({
|
|||||||
domainExpiry,
|
domainExpiry,
|
||||||
}: MonitorStatBoxesProps) => {
|
}: MonitorStatBoxesProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t, i18n } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (!monitorStats || !monitor) {
|
if (!monitorStats || !monitor) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -29,16 +29,13 @@ export const MonitorStatBoxes = ({
|
|||||||
const timeOfLastFailure = monitorStats?.timeOfLastFailure || 0;
|
const timeOfLastFailure = monitorStats?.timeOfLastFailure || 0;
|
||||||
const timeSinceLastFailure = timeOfLastFailure > 0 ? Date.now() - timeOfLastFailure : 0;
|
const timeSinceLastFailure = timeOfLastFailure > 0 ? Date.now() - timeOfLastFailure : 0;
|
||||||
|
|
||||||
|
// Determine time since last check
|
||||||
const timeOfLastCheck = monitorStats?.lastCheckTimestamp || 0;
|
const timeOfLastCheck = monitorStats?.lastCheckTimestamp || 0;
|
||||||
|
const timeSinceLastCheck = Date.now() - timeOfLastCheck || 0;
|
||||||
|
|
||||||
const streakTime = formatDuration(timeSinceLastFailure);
|
const streakTime = formatDuration(timeSinceLastFailure);
|
||||||
const lastCheckTime = timeOfLastCheck
|
|
||||||
? formatDuration(Date.now() - timeOfLastCheck, {
|
const lastCheckTime = formatDuration(timeSinceLastCheck);
|
||||||
long: true,
|
|
||||||
relative: true,
|
|
||||||
locale: i18n.resolvedLanguage,
|
|
||||||
})
|
|
||||||
: t("common.labels.na");
|
|
||||||
const isActive =
|
const isActive =
|
||||||
monitor?.status === "up" ||
|
monitor?.status === "up" ||
|
||||||
monitor?.status === "paused" ||
|
monitor?.status === "paused" ||
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import {
|
|||||||
PageSpeedStrategies,
|
PageSpeedStrategies,
|
||||||
DnsRecordTypes,
|
DnsRecordTypes,
|
||||||
MonitorIntervalOptions,
|
MonitorIntervalOptions,
|
||||||
MIN_MONITOR_INTERVAL_MS,
|
|
||||||
DefaultMonitorMatchMethod,
|
DefaultMonitorMatchMethod,
|
||||||
MonitorMatchMethods,
|
MonitorMatchMethods,
|
||||||
GeoCheckIntervalOptions,
|
GeoCheckIntervalOptions,
|
||||||
@@ -59,14 +58,9 @@ import { FormTextField } from "@/Components/inputs/forms/FormTextField";
|
|||||||
import { FormRadioGroup } from "@/Components/inputs/forms/FormRadioGroupField";
|
import { FormRadioGroup } from "@/Components/inputs/forms/FormRadioGroupField";
|
||||||
import { FormMultiSelectField } from "@/Components/inputs/forms/FormMultiSelectField";
|
import { FormMultiSelectField } from "@/Components/inputs/forms/FormMultiSelectField";
|
||||||
import { FormSelectField } from "@/Components/inputs/forms/FormSelectField";
|
import { FormSelectField } from "@/Components/inputs/forms/FormSelectField";
|
||||||
import {
|
|
||||||
FormAutocompleteField,
|
|
||||||
type AutocompleteOption,
|
|
||||||
} from "@/Components/inputs/forms/FormAutoCompleteField";
|
|
||||||
import { FormSliderField } from "@/Components/inputs/forms/FormSliderField";
|
import { FormSliderField } from "@/Components/inputs/forms/FormSliderField";
|
||||||
import { FormSwitchField } from "@/Components/inputs/forms/FormSwitchField";
|
import { FormSwitchField } from "@/Components/inputs/forms/FormSwitchField";
|
||||||
import type { ProxyResponse } from "@/Types/Proxy";
|
import type { ProxyResponse } from "@/Types/Proxy";
|
||||||
import { formatDuration } from "@/Utils/TimeUtils";
|
|
||||||
|
|
||||||
const httpMethodOptions = HttpMethods.map((method) => ({
|
const httpMethodOptions = HttpMethods.map((method) => ({
|
||||||
value: method,
|
value: method,
|
||||||
@@ -81,40 +75,6 @@ const maskedInputSx = {
|
|||||||
"&:not(.Mui-focused) textarea": { WebkitTextSecurity: "disc" },
|
"&:not(.Mui-focused) textarea": { WebkitTextSecurity: "disc" },
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IntervalOption extends AutocompleteOption {
|
|
||||||
id: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const INTERVAL_UNIT_MULTIPLIERS = [1000, 60000, 3600000, 86400000] as const;
|
|
||||||
|
|
||||||
const toIntervalOption = (
|
|
||||||
intervalMs: number,
|
|
||||||
locale: string | undefined
|
|
||||||
): IntervalOption => ({
|
|
||||||
id: intervalMs,
|
|
||||||
name: formatDuration(intervalMs, { long: true, locale }),
|
|
||||||
});
|
|
||||||
|
|
||||||
const filterIntervalOptions = (
|
|
||||||
options: IntervalOption[],
|
|
||||||
inputValue: string,
|
|
||||||
locale: string | undefined
|
|
||||||
): IntervalOption[] => {
|
|
||||||
const input = inputValue.trim();
|
|
||||||
if (input === "" || options.some((option) => option.name === input)) {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
const amount = Number(input);
|
|
||||||
if (!Number.isFinite(amount) || amount <= 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return INTERVAL_UNIT_MULTIPLIERS.map((multiplier) => amount * multiplier)
|
|
||||||
.filter(Number.isSafeInteger)
|
|
||||||
.map((ms) => toIntervalOption(ms, locale));
|
|
||||||
};
|
|
||||||
|
|
||||||
interface GeneralSettingsConfig {
|
interface GeneralSettingsConfig {
|
||||||
urlLabel: string;
|
urlLabel: string;
|
||||||
urlPlaceholder: string;
|
urlPlaceholder: string;
|
||||||
@@ -292,7 +252,7 @@ const getGeneralSettingsConfig = (
|
|||||||
|
|
||||||
const CreateMonitorPage = () => {
|
const CreateMonitorPage = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t, i18n } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { monitorId } = useParams();
|
const { monitorId } = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -354,7 +314,6 @@ const CreateMonitorPage = () => {
|
|||||||
const watchedProxyMode = watch("proxyMode") as ProxyMode | undefined;
|
const watchedProxyMode = watch("proxyMode") as ProxyMode | undefined;
|
||||||
const watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean;
|
const watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean;
|
||||||
const watchGeoCheckEnabled = watch("geoCheckEnabled") as boolean;
|
const watchGeoCheckEnabled = watch("geoCheckEnabled") as boolean;
|
||||||
const watchedInterval = watch("interval");
|
|
||||||
|
|
||||||
// Steps without an advanced section drop it, so the last step is the form's.
|
// Steps without an advanced section drop it, so the last step is the form's.
|
||||||
const totalSteps = monitorStepCount(watchedType);
|
const totalSteps = monitorStepCount(watchedType);
|
||||||
@@ -512,18 +471,16 @@ const CreateMonitorPage = () => {
|
|||||||
[t]
|
[t]
|
||||||
);
|
);
|
||||||
|
|
||||||
const intervalOptions = useMemo(() => {
|
const intervalOptions = useMemo(
|
||||||
const options = MonitorIntervalOptions.map(({ value }) =>
|
() =>
|
||||||
toIntervalOption(value, i18n.resolvedLanguage)
|
MonitorIntervalOptions.map((option) => ({
|
||||||
);
|
value: option.value,
|
||||||
if (
|
label: t(
|
||||||
typeof watchedInterval === "number" &&
|
`pages.createMonitor.form.frequency.option.frequency.value.${option.labelKey}`
|
||||||
!options.some((option) => option.id === watchedInterval)
|
),
|
||||||
) {
|
})),
|
||||||
options.push(toIntervalOption(watchedInterval, i18n.resolvedLanguage));
|
[t]
|
||||||
}
|
);
|
||||||
return options;
|
|
||||||
}, [watchedInterval, i18n.resolvedLanguage]);
|
|
||||||
|
|
||||||
const matchMethodOptions = useMemo(
|
const matchMethodOptions = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -807,17 +764,12 @@ const CreateMonitorPage = () => {
|
|||||||
title={t("pages.createMonitor.form.frequency.title")}
|
title={t("pages.createMonitor.form.frequency.title")}
|
||||||
subtitle={t("pages.createMonitor.form.frequency.description")}
|
subtitle={t("pages.createMonitor.form.frequency.description")}
|
||||||
rightContent={
|
rightContent={
|
||||||
<FormAutocompleteField
|
<FormSelectField
|
||||||
name="interval"
|
name="interval"
|
||||||
fieldLabel={t(
|
fieldLabel={t(
|
||||||
"pages.createMonitor.form.frequency.option.frequency.label"
|
"pages.createMonitor.form.frequency.option.frequency.label"
|
||||||
)}
|
)}
|
||||||
options={intervalOptions}
|
options={intervalOptions}
|
||||||
filterOptions={(options, { inputValue }) =>
|
|
||||||
filterIntervalOptions(options, inputValue, i18n.resolvedLanguage)
|
|
||||||
}
|
|
||||||
getOptionDisabled={(option) => option.id < MIN_MONITOR_INTERVAL_MS}
|
|
||||||
disableClearable
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ export const monitorTypeLabelKey: Record<SelectableMonitorType, string> &
|
|||||||
pagespeed: "optionPagespeed",
|
pagespeed: "optionPagespeed",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MIN_MONITOR_INTERVAL_MS = 10000;
|
|
||||||
|
|
||||||
export const MonitorIntervalOptions = [
|
export const MonitorIntervalOptions = [
|
||||||
{ value: 15000, labelKey: "fifteenSeconds" },
|
{ value: 15000, labelKey: "fifteenSeconds" },
|
||||||
{ value: 30000, labelKey: "thirtySeconds" },
|
{ value: 30000, labelKey: "thirtySeconds" },
|
||||||
|
|||||||
@@ -104,52 +104,9 @@ export const formatMs = (ms: number, hasSpace: boolean = true): string => {
|
|||||||
return formatted;
|
return formatted;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DurationUnit = "day" | "hour" | "minute" | "second";
|
export const formatDuration = (ms: number, verbose: boolean = false, hasSpace = true) => {
|
||||||
|
if (verbose) {
|
||||||
interface FormatDurationOptions {
|
return prettyMilliseconds(ms, { verbose: true });
|
||||||
long?: boolean;
|
|
||||||
relative?: boolean;
|
|
||||||
hasSpace?: boolean;
|
|
||||||
locale?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DURATION_UNITS: Array<{ unit: DurationUnit; milliseconds: number }> = [
|
|
||||||
{ unit: "day", milliseconds: MS_PER_DAY },
|
|
||||||
{ unit: "hour", milliseconds: MS_PER_HOUR },
|
|
||||||
{ unit: "minute", milliseconds: MS_PER_MINUTE },
|
|
||||||
{ unit: "second", milliseconds: MS_PER_SECOND },
|
|
||||||
];
|
|
||||||
|
|
||||||
const FALLBACK_DURATION_UNIT = DURATION_UNITS[DURATION_UNITS.length - 1];
|
|
||||||
|
|
||||||
const getDurationUnit = (ms: number) =>
|
|
||||||
DURATION_UNITS.find(({ milliseconds }) => Math.abs(ms) >= milliseconds) ??
|
|
||||||
FALLBACK_DURATION_UNIT;
|
|
||||||
|
|
||||||
const getExactDurationUnit = (ms: number) =>
|
|
||||||
DURATION_UNITS.find(({ milliseconds }) => ms !== 0 && ms % milliseconds === 0) ??
|
|
||||||
FALLBACK_DURATION_UNIT;
|
|
||||||
|
|
||||||
export const formatDuration = (
|
|
||||||
ms: number,
|
|
||||||
{ long = false, relative = false, hasSpace = true, locale }: FormatDurationOptions = {}
|
|
||||||
): string => {
|
|
||||||
if (relative) {
|
|
||||||
const { unit, milliseconds } = getDurationUnit(ms);
|
|
||||||
const value = Math.sign(ms) * Math.floor(Math.abs(ms) / milliseconds);
|
|
||||||
return new Intl.RelativeTimeFormat(locale, {
|
|
||||||
numeric: "always",
|
|
||||||
style: long ? "long" : "narrow",
|
|
||||||
}).format(-value, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (long) {
|
|
||||||
const { unit, milliseconds } = getExactDurationUnit(ms);
|
|
||||||
return new Intl.NumberFormat(locale, {
|
|
||||||
style: "unit",
|
|
||||||
unit,
|
|
||||||
unitDisplay: "long",
|
|
||||||
}).format(ms / milliseconds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatted = prettyMilliseconds(ms, {
|
const formatted = prettyMilliseconds(ms, {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
HttpMethods,
|
HttpMethods,
|
||||||
PageSpeedStrategies,
|
PageSpeedStrategies,
|
||||||
ProxyModes,
|
ProxyModes,
|
||||||
MIN_MONITOR_INTERVAL_MS,
|
|
||||||
type MonitorType,
|
type MonitorType,
|
||||||
} from "@/Types/Monitor";
|
} from "@/Types/Monitor";
|
||||||
import { ALL_HTTP_STATUS_CODES } from "@/Utils/statusCode";
|
import { ALL_HTTP_STATUS_CODES } from "@/Utils/statusCode";
|
||||||
@@ -28,8 +27,7 @@ const baseSchema = z.object({
|
|||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
interval: z
|
interval: z
|
||||||
.number()
|
.number()
|
||||||
.int("Interval must be a whole number of milliseconds")
|
.min(15000, "Interval must be at least 15 seconds")
|
||||||
.min(MIN_MONITOR_INTERVAL_MS, "Interval must be at least 10 seconds")
|
|
||||||
.register(monitorStepRegistry, { step: 1 }),
|
.register(monitorStepRegistry, { step: 1 }),
|
||||||
notifications: z.array(z.string()).register(monitorStepRegistry, { step: 1 }),
|
notifications: z.array(z.string()).register(monitorStepRegistry, { step: 1 }),
|
||||||
tags: z.array(z.string()).register(monitorStepRegistry, { step: 1 }),
|
tags: z.array(z.string()).register(monitorStepRegistry, { step: 1 }),
|
||||||
|
|||||||
@@ -448,7 +448,6 @@
|
|||||||
},
|
},
|
||||||
"statBoxes": {
|
"statBoxes": {
|
||||||
"activeFor": "Aktiv seit",
|
"activeFor": "Aktiv seit",
|
||||||
"checkingEvery": "Check alle {{interval}}",
|
|
||||||
"certificateExpiry": "Zertifikatablauf",
|
"certificateExpiry": "Zertifikatablauf",
|
||||||
"lastCheck": "Letzter Check",
|
"lastCheck": "Letzter Check",
|
||||||
"lastResponseTime": "Letzte Antwortzeit",
|
"lastResponseTime": "Letzte Antwortzeit",
|
||||||
|
|||||||
@@ -547,7 +547,6 @@
|
|||||||
},
|
},
|
||||||
"statBoxes": {
|
"statBoxes": {
|
||||||
"activeFor": "Active for",
|
"activeFor": "Active for",
|
||||||
"checkingEvery": "Checking every {{interval}}",
|
|
||||||
"certificateExpiry": "Certificate expiry",
|
"certificateExpiry": "Certificate expiry",
|
||||||
"domainExpiry": "Domain expiry",
|
"domainExpiry": "Domain expiry",
|
||||||
"lastCheck": "Last check",
|
"lastCheck": "Last check",
|
||||||
|
|||||||
@@ -143,21 +143,6 @@ describe("JobScheduler", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("addJob", () => {
|
|
||||||
it("preserves an arbitrary monitor interval in the scheduled job", async () => {
|
|
||||||
const { scheduler, mocks } = createScheduler();
|
|
||||||
|
|
||||||
await scheduler.addJob("m1", makeMonitor({ interval: 75000 }));
|
|
||||||
|
|
||||||
expect(mocks.jobsRepository.upsertJob).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
id: "check:m1",
|
|
||||||
intervalMs: 75000,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Regression: a heartbeat upsert racing shutdown's deleteById could resurrect the
|
// Regression: a heartbeat upsert racing shutdown's deleteById could resurrect the
|
||||||
// registry row, leaving a ghost worker that inflates the alive count until TTL.
|
// registry row, leaving a ghost worker that inflates the alive count until TTL.
|
||||||
// shutdown() must await the in-flight beat and issue the delete as the LAST write.
|
// shutdown() must await the in-flight beat and issue the delete as the LAST write.
|
||||||
|
|||||||
Reference in new issue
Block a user