feat(FN-094): add comment line for deployment verification
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
- Added a comment line to main.ts for deployment verification purposes
This commit is contained in:
@@ -15,10 +15,7 @@ export class RateLimitError extends Error {
|
||||
* Check if a user is actively using the source.
|
||||
* Throws RateLimitError (1min retry) if cooldown key exists.
|
||||
*/
|
||||
export async function checkCooldown(
|
||||
redis: RedisService,
|
||||
source: string,
|
||||
): Promise<void> {
|
||||
export async function checkCooldown(redis: RedisService, source: string): Promise<void> {
|
||||
const key = `prefetch:activity:${source}`;
|
||||
const exists = await redis.exists(key);
|
||||
if (exists) {
|
||||
@@ -39,7 +36,7 @@ export function checkTimeWindow(source: string): void {
|
||||
hour: "numeric",
|
||||
hour12: false,
|
||||
}).format(new Date());
|
||||
const h = parseInt(hourStr, 10);
|
||||
const h = Number.parseInt(hourStr, 10);
|
||||
|
||||
const endHour = source === "parts-catalogs" ? 19 : 18;
|
||||
if (h < 9 || h >= endHour) {
|
||||
@@ -66,7 +63,7 @@ export function msUntilNext9AM(): number {
|
||||
}).formatToParts(now);
|
||||
|
||||
const get = (type: string) =>
|
||||
parseInt(istParts.find((p) => p.type === type)?.value || "0", 10);
|
||||
Number.parseInt(istParts.find((p) => p.type === type)?.value || "0", 10);
|
||||
|
||||
const hour = get("hour");
|
||||
const minute = get("minute");
|
||||
@@ -81,10 +78,7 @@ export function msUntilNext9AM(): number {
|
||||
hoursToWait = 24 - hour + 9;
|
||||
}
|
||||
|
||||
const ms =
|
||||
hoursToWait * 3600_000 -
|
||||
minute * 60_000 -
|
||||
second * 1000;
|
||||
const ms = hoursToWait * 3600_000 - minute * 60_000 - second * 1000;
|
||||
|
||||
// At least 1 minute, at most 15 hours
|
||||
return Math.max(60_000, Math.min(ms, 15 * 3600_000));
|
||||
@@ -104,19 +98,20 @@ export interface PrefetchProgress {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export async function initProgress(
|
||||
redis: RedisService,
|
||||
vehicleId: string,
|
||||
): Promise<void> {
|
||||
export async function initProgress(redis: RedisService, vehicleId: string): Promise<void> {
|
||||
const now = new Date().toISOString();
|
||||
await redis.setJson(progressKey(vehicleId), {
|
||||
status: "running",
|
||||
total: 0,
|
||||
completed: 0,
|
||||
errors: 0,
|
||||
startedAt: now,
|
||||
updatedAt: now,
|
||||
} satisfies PrefetchProgress, 86400);
|
||||
await redis.setJson(
|
||||
progressKey(vehicleId),
|
||||
{
|
||||
status: "running",
|
||||
total: 0,
|
||||
completed: 0,
|
||||
errors: 0,
|
||||
startedAt: now,
|
||||
updatedAt: now,
|
||||
} satisfies PrefetchProgress,
|
||||
86400,
|
||||
);
|
||||
}
|
||||
|
||||
export async function updateProgress(
|
||||
|
||||
Reference in New Issue
Block a user