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.
TypeScript
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
TypeScript
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),
]);
}
TL;DR
A developer's function with a while loop checking for expired dates in documents triggers a curl error when run by a cron job. The error message is `An internal curl error has occurred within the executor! Error Number: 104. Error Msg: Connection reset by peer\nError Code: 500`. The loop runs smoothly without the while loop.How long does it run before this happens?
1 - 3 seconds
And it happens every time?
yes, everytime
Recommended threads
- Function's Static IP
Is it possible to have static. IP Address instead of Dynamic IP for getting the IP Address whitelist
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- [SOLVED] Unable to push function from AP...
When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions. ``` $ appwrite client --endpoint $...