I have a function that loops through documents to check to check their expiredDate . It results to error when I run the function triggered by a cron job.
An internal curl error has occurred within the executor! Error Number: 104. Error Msg: Connection reset by peer\nError Code: 500
It runs fine when I remove the while loop. Here's the code
while (products.total > 0) {
for (const product of products.documents) {
if (new Date(product.expiryDate) < new Date()) {
await db.createDocument("drug-inventory", "notification", ID.unique(), {
type: "expired-drug",
isAdmin: false,
product: product.$id,
expiredDate: product.expiryDate,
});
}
}
offset += 50;
products = await db.listDocuments("drug-inventory", "products", [
Query.limit(50),
Query.offset(offset),
]);
}
How long does it run before this happens?
1 - 3 seconds
And it happens every time?
yes, everytime
Recommended threads
- Worker functions stuck on "Fetched 0 fun...
Appwrite Version: 1.9.0 Bug Description: The appwrite-worker-functions container gets stuck in an infinite loop logging "Fetched 0 functions..." while scheduled...
- I am using s3 for app storage but is it ...
_APP_STORAGE_DEVICE=s3 puts everything to the s3 storage but i need to be able to keep the function builds and site in the local and not waste the cloud storage...
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...