What is your goal?
I want to make two connected Make scenarios fully idempotent and reliable before increasing Shopify traffic through advertising.
Scenario 1 runs every 30 minutes and imports paid Shopify orders into an Orders_Log sheet. It stores the Shopify order_id and sets order_items_logged = NO.
Scenario 2 runs every 15 minutes. It searches Orders_Log for paid orders where order_items_logged = NO, retrieves the Shopify order, iterates its line items, adds them to Order_Items_Log, and finally updates the original order row to order_items_logged = YES.
My goal is to prevent duplicate order rows and duplicate line-item rows in case of retries, incomplete executions, timeouts, or overlapping scenario runs.
What is the problem & what have you tried?
The scenarios are currently working, but I would like to validate the architecture before the order volume increases.
My main concern is that two executions of Scenario 2 could select the same order while order_items_logged is still NO. A retry or incomplete execution could also add the same line items more than once before the final status update is completed.
Currently:
- Orders_Log uses Shopify order_id as the main order identifier.
- Scenario 2 filters:
- financial_status = paid
- analysis_include = YES
- order_items_logged = NO
- It retrieves the Shopify order.
- It iterates all line items.
- It adds one row per item to Order_Items_Log.
- Only after all items have been added, it updates Orders_Log:
- order_items_logged = YES
- status = logged
I am considering using:
- Shopify order_id as the unique key in Orders_Log.
- order_id + line_item_id as the unique key in Order_Items_Log.
- A temporary status such as processing before starting the Iterator.
- Sequential processing or limiting the number of simultaneous executions.
- A search-before-insert or update/upsert pattern instead of always using Add a Row.
Could you please advise on the safest Make design?
Specifically:
- Is order_id + line_item_id the correct idempotency key for Shopify line items?
- Should I change the order status from NO to processing before the Iterator begins?
- How can I prevent another execution from selecting the same processing order?
- Is sequential processing sufficient, or should I also set the maximum number of simultaneous runs to 1?
- Should each line item be searched in Google Sheets before being added?
- Would an upsert pattern be safer than Add a Row?
- What should happen if three line items are added successfully but the fourth one fails?
- Which settings do you recommend for incomplete executions, automatic retries, and error handlers?
- Are there particular risks when Google Sheets row numbers change or when multiple executions update the same sheet?
- What is the recommended recovery procedure for orders left in processing after a failed execution?
Error messages or input/output bundles
There is no active error at the moment. This is a preventive architecture and idempotency review.
The main failure cases I want to protect against are:
- The same Shopify order being selected by two scenario executions.
- A retry adding the same line items again.
- An execution failing after only some line items have been written.
- The final Orders_Log update not running after the Iterator.
- Google Sheets rows being updated incorrectly because of concurrent changes.