Allow job retries to successfully send notifications
This commit is contained in:
parent
c47812c706
commit
0c0655a7e5
@ -18,14 +18,12 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
if (coconutToken !== token) return jsonError("Forbidden", 403);
|
if (coconutToken !== token) return jsonError("Forbidden", 403);
|
||||||
|
|
||||||
await context.env.DATA.delete(`coconutjob_${attachment}`);
|
|
||||||
|
|
||||||
const aws = new AwsClient({
|
const aws = new AwsClient({
|
||||||
accessKeyId: context.env.R2_ACCESS_KEY,
|
accessKeyId: context.env.R2_ACCESS_KEY,
|
||||||
secretAccessKey: context.env.R2_SECRET_KEY,
|
secretAccessKey: context.env.R2_SECRET_KEY,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { event } = await context.request.json() as { event: string };
|
const { event } = (await context.request.json()) as { event: string };
|
||||||
|
|
||||||
if (event === "job.failed") {
|
if (event === "job.failed") {
|
||||||
await fetch(context.env.REPORTS_WEBHOOK, {
|
await fetch(context.env.REPORTS_WEBHOOK, {
|
||||||
@ -53,6 +51,7 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
method: "PUT",
|
method: "PUT",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await context.env.DATA.delete(`coconutjob_${attachment}`);
|
||||||
await context.env.R2.delete(`${attachment}.mp4`);
|
await context.env.R2.delete(`${attachment}.mp4`);
|
||||||
|
|
||||||
if (!copyResp.ok)
|
if (!copyResp.ok)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user