Runs every 15 min
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export async function hnFollowPollJobError({ lastRunAt }: Interval) {
try {
let posts = await hnLatestPosts({
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text, subject } = await hnEmail({ posts });
console.log(posts);
console.log(!posts.length);
if (!posts.length)
await email({ subject: "HN Follow may be bugging" });
}
catch (e) {
console.log("error");
await email({ subject: "HN Follow may be bugging" });
throw e;
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023