Skip to content

Commit b18bf54

Browse files
Add decription
1 parent 551be96 commit b18bf54

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/content/docs/workflows/examples/backup-d1.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ description: Send invoice when shopping cart is checked out and paid for
1717

1818
import { TabItem, Tabs } from "~/components"
1919

20-
WIP
20+
In this example, we implement a Workflow that is triggered peridiocally by a [Cron Trigger](/workers/configuration/cron-triggers) to start a backup for a D1 database using the REST API and finally store the SQL dump into an R2 bucket.
2121

22-
In this example, we implement a Workflow that is triggered by a Cron Trigger to back up your D1 database and store the SQL dump into an R2 bucket.
22+
Once a Workflow instance is triggered, it fetches the REST API to start an export job for a specific database. Then it will start fethcing the same endpoint to check if the backup job is done and the SQL dump ready to download.
2323

24-
Once a Workflow instance is triggered, it starts polling a [D1](/d1) database for the cart ID until it has been checked out. Once the shopping cart is checked out, we proceed to process the payment with an external provider doing a fetch POST. Finally, assuming everything goes well, we try to send an email using [Email Workers](/email-routing/email-workers/) with the invoice to the customer.
24+
As you can see, Workflows handles the responses and failures; it will retry the API calls until we get a successful response, retry fetching the backup from the url provided, and retry saving the file to R2. The developer doesn't have to care about any of that logic, and the workflow can run until the backup file is ready, handling all the possible conditions until it is completed.
2525

26-
As you can see, Workflows handles all the different service responses and failures; it will retry D1 until the cart is checked out, retry the payment processor if it fails for some reason, and retry sending the email with the invoice if it can't. The developer doesn't have to care about any of that logic, and the workflow can run for hours, handling all the possible conditions until it is completed.
27-
28-
This is a simplified example of processing a shopping cart. We would assume more steps and additional logic in a real-life scenario, but this example gives you a good idea of what you can do with Workflows.
26+
This is a simplified example of backing up a [D1](/d1) database. We are using the [default](/workflows/build/sleeping-and-retrying) sleeping and retrying configuration for every step. We would assume more steps and additional logic in a real-life scenario, but this example gives you a good idea of what you can do with Workflows.
2927

3028
```ts
3129
import {

0 commit comments

Comments
 (0)