Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
RafidMuhymin committed May 30, 2024
2 parents 6b82fba + 34c399f commit a3f9e88
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
- name: Deploy to Cloudflare Workers
shell: bash
run: |
for worker_src in src/workers/*; do git diff ${{ github.event.before }} HEAD -- $worker_src |& (grep -q . && cd $worker_src && ${{ github.ref == 'refs/heads/dev' && 'grep -q "\[env.development\]" wrangler.toml &&' || '' }} pnpm wrangler deploy ${{ github.ref == 'refs/heads/dev' && '--env=development' || '' }}) & done; wait
for worker_src in src/workers/*; do git diff ${{ github.event.before }} HEAD -- pnpm-lock.yaml src/utils $worker_src |& (grep -q . && cd $worker_src && ${{ github.ref == 'refs/heads/dev' && 'grep -q "\[env.development\]" wrangler.toml &&' || '' }} pnpm wrangler deploy ${{ github.ref == 'refs/heads/dev' && '--env=development' || '' }}) & done; wait
2 changes: 1 addition & 1 deletion src/utils/D1Strapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function D1Strapi(
alternateENV?: typeof env,
): Promise<StrapiCollections> {
if (!strapiCollections) {
const { results } = await ({ ...alternateENV, ...env }.USERS as D1Database)
const { results } = await ((env.USERS || alternateENV.USERS) as D1Database)
.prepare("SELECT * FROM strapi")
.all();

Expand Down
60 changes: 30 additions & 30 deletions src/utils/createModuleWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,36 +103,36 @@ export default function (paths) {
shouldClearRetrySchedule =
retryEnabled && (lastAttempt || (!error && isAnAttempt));

await Promise.all([
storeContext(),
(shouldRetry || shouldClearRetrySchedule) &&
env.RETRY_WORKERS.fetch(request.url, {
method: shouldRetry ? "POST" : "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
requestID,
stringifiedRequest: shouldRetry
? stringifiedRequest
: undefined,
error: error
? {
message: error.message,
subject: error.subject || "Error in " + origin,
bodyText:
error.bodyText || "An error occurred in " + origin,
requestData: error.requestData,
responseData: error.responseData,
notifySales:
error.notifySales &&
lastAttempt &&
!hostname.startsWith("dev."),
}
: undefined,
}),
}).then((res) => res.text()),
]);
await storeContext();

if (shouldRetry || shouldClearRetrySchedule) {
await env.RETRY_WORKERS.fetch(request.url, {
method: shouldRetry ? "POST" : "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
requestID,
stringifiedRequest: shouldRetry
? stringifiedRequest
: undefined,
error: error
? {
message: error.message,
subject: error.subject || "Error in " + origin,
bodyText:
error.bodyText || "An error occurred in " + origin,
requestData: error.requestData,
responseData: error.responseData,
notifySales:
error.notifySales &&
lastAttempt &&
!hostname.startsWith("dev."),
}
: undefined,
}),
}).then((res) => res.text());
}

if (error) {
return reply(
Expand Down

0 comments on commit a3f9e88

Please sign in to comment.