Commit
·
99fbfe2
1
Parent(s):
58ea57b
✨ Keep space alive
Browse files
server.ts
CHANGED
@@ -125,6 +125,8 @@ process.on("unhandledRejection", async (err) => {
|
|
125 |
console.error("unhandled rejection", err);
|
126 |
});
|
127 |
|
|
|
|
|
128 |
async function run() {
|
129 |
while (1) {
|
130 |
console.log("looking up");
|
@@ -134,3 +136,10 @@ async function run() {
|
|
134 |
}
|
135 |
|
136 |
run();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
console.error("unhandled rejection", err);
|
126 |
});
|
127 |
|
128 |
+
process.on("uncaughtException", console.error);
|
129 |
+
|
130 |
async function run() {
|
131 |
while (1) {
|
132 |
console.log("looking up");
|
|
|
136 |
}
|
137 |
|
138 |
run();
|
139 |
+
|
140 |
+
const SPACE_ID = process.env.SPACE_ID || "huggingface-projects/twitter-alt-image-bot";
|
141 |
+
|
142 |
+
// Keep space alive
|
143 |
+
setInterval(() => {
|
144 |
+
fetch(`https://${SPACE_ID.replace("/", "-")}.hf.space`);
|
145 |
+
}, 24 * 3600 * 1000);
|