tangled
alpha
login
or
join now
openstatus.dev
/
openstatus
6
fork
atom
Openstatus
www.openstatus.dev
6
fork
atom
overview
issues
pulls
pipelines
feat: new temp task
mxkaske
2 years ago
39ca0472
abd6301b
+21
-1
1 changed file
expand all
collapse all
unified
split
apps
web
src
app
api
checker
cron
_cron.ts
+21
-1
apps/web/src/app/api/checker/cron/_cron.ts
reviewed
···
80
80
Authorization: `Basic ${env.CRON_SECRET}`,
81
81
},
82
82
httpMethod: "POST",
83
83
-
url: "https://checker.openstatus.dev/",
83
83
+
url: "https://api.openstatus.dev/checkerV2",
84
84
body: Buffer.from(JSON.stringify(payload)).toString("base64"),
85
85
},
86
86
};
···
88
88
const [response] = await client.createTask(request);
89
89
90
90
allResult.push(response);
91
91
+
92
92
+
/**
93
93
+
* Pushing to our Golang endpoint
94
94
+
*/
95
95
+
const tempTask: google.cloud.tasks.v2beta3.ITask = {
96
96
+
httpRequest: {
97
97
+
headers: {
98
98
+
"Content-Type": "application/json", // Set content type to ensure compatibility your application's request parsing
99
99
+
...(region !== "auto" && { "fly-prefer-region": region }), // Specify the region you want the request to be sent to
100
100
+
Authorization: `Basic ${env.CRON_SECRET}`,
101
101
+
},
102
102
+
httpMethod: "POST",
103
103
+
url: "https://checker.openstatus.dev/",
104
104
+
body: Buffer.from(JSON.stringify(payload)).toString("base64"),
105
105
+
},
106
106
+
};
107
107
+
const tempRequest = { parent: parent, task: tempTask };
108
108
+
const [tempResponse] = await client.createTask(tempRequest);
109
109
+
110
110
+
allResult.push(tempResponse);
91
111
}
92
112
}
93
113
await Promise.all(allResult);