Hey I’m trying to create expiring feature for inserted items.
I’m using afterInsert data hook and setTimeout :
import { fetch } from 'wix-fetch';
import wixData from 'wix-data';
const sleep = m => new Promise(r => setTimeout(r, m))
export async function Hookz_afterInsert(item, context) {
console.log("item inserted")
console.log(item)
await sleep(1000 * 30)
let removed = await wixData.remove("Hookz", item._id)
console.log(removed)
return item
}
However, I’m getting an ExecutionTimeoutError error:
save operation failed: ExecutionTimeoutError: WebMethod request timed-out after 14 seconds... Did you forget to resolve a promise?
It appears that backend functions have a limit of 14 seconds timeout.
Is there another way to implement this functionality ?
Thanks