drastically reduce time to create photo folders
This commit is contained in:
@ -22,6 +22,11 @@ export function onEditQueue(e) {
|
||||
console.log("No SKU found for row " + row)
|
||||
return
|
||||
}
|
||||
// Make sure SKU conforms to expected patterns
|
||||
if (sku.match(`\\?`) || sku.match(`n$`)) {
|
||||
console.log("SKU is a placeholder ('?' or 'n...'), skipping batching.")
|
||||
return
|
||||
}
|
||||
// Acquire a user lock to prevent multiple onEdit calls from clashing
|
||||
const documentLock = LockService.getDocumentLock()
|
||||
try {
|
||||
@ -85,6 +90,11 @@ export function processBatchedEdits() {
|
||||
console.log(
|
||||
`Processing SKU ${edit.sku}, Timestamp: ${new Date(edit.timestamp)}`
|
||||
)
|
||||
// Make sure SKU conforms to expected patterns
|
||||
if (!edit.sku.match(/^\w+-\d{4}$/)) {
|
||||
console.log(`SKU ${edit.sku} is not valid, skipping processing.`)
|
||||
return
|
||||
}
|
||||
let p = new Product(edit.sku)
|
||||
p.UpdateShopifyProduct(shop)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user