Skip to content

Commit fa2859b

Browse files
committed
always await errors
cloudflare does not count time waiting on http requests anyway. this also breaks local execution i guess
1 parent 0c6e1dd commit fa2859b

File tree

4 files changed

+2
-7
lines changed

4 files changed

+2
-7
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ disgit has the following optional environment variables that you can use to cust
1717
- `IGNORED_BRANCHES` - A comma seperated list of branches that should be ignored
1818
- `IGNORED_USERS` - A comma seperated list of users that should be ignored
1919
- `IGNORED_PAYLOADS` - A comma seperated list of webhook events that should be ignored
20-
- `AWAIT_ERRORS` - Set to `true` to await errors from the Discord webhook executor
2120
- `DEBUG_PASTE` - Set to `true` to enable debug embeds.
2221

2322
## Supported Events

docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ services:
77
- IGNORED_BRANCHES=${IGNORED_BRANCHES}
88
- IGNORED_USERS=${IGNORED_USERS}
99
- IGNORED_PAYLOADS=${IGNORED_PAYLOADS}
10-
- AWAIT_ERRORS=${AWAIT_ERRORS}
1110
- DEBUG_PASTE=${DEBUG_PASTE}
1211
volumes:
1312
- ./.storage/cache:/worker/cache

src/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ async function handleRequest(request: Request, env: BoundEnv): Promise<Response>
3434
return new Response('Missing Webhook Authorization', { status: 400 });
3535
}
3636

37-
const promise = fetch(`https://discord.com/api/webhooks/${hookId}/${hookToken}`, {
37+
const result = await fetch(`https://discord.com/api/webhooks/${hookId}/${hookToken}`, {
3838
headers: {
3939
"content-type": "application/json;charset=UTF=8"
4040
},
4141
method: "POST",
4242
body: embed
4343
})
4444

45-
let result = env.awaitErrors ? await promise : undefined;
46-
47-
if (result === undefined || result.ok) {
45+
if (result.ok) {
4846
return new Response(`disgit successfully executed webhook ${hookId}`, { status: 200 });
4947
}
5048

wrangler.toml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ IGNORED_BRANCH_REGEX=""
1010
IGNORED_BRANCHES=""
1111
IGNORED_USERS=""
1212
IGNORED_PAYLOADS=""
13-
AWAIT_ERRORS=true
1413
DEBUG_PASTE=false
1514

1615
# Uses secrets:

0 commit comments

Comments
 (0)