Back

Functions seem broken

  • 0
  • Self Hosted
  • Functions
punti_z
13 Jul, 2024, 03:55

I have a function that tries to add documents to a collection, first I wrote the function to check if the document exists by ID and if so, not add it. After the first run the async queue went sideways and all my other async function went on "waiting" for a few minutes, completely broke production. Then I did a "try catch" to write a document and if Doc ID exists it will catch but that also after first few runs sent rest of my async functions on "waiting". Just to be clear, working with Dart runtimes and the number of check can in the tens of thousands and fails can be as well but I would not expect the system to then take a 20 minute breather to recover.

Not sure why since none of the container logs point me to a direction as to why it happens but if you stress the function out with too much database checks and fails the whole thing goes on a waiting spree and everything async stops.

has anyone else faced this and has a work around ?

TL;DR
Issue: Async functions causing delays and queue problems in production when dealing with numerous database checks and failures. Solution: One approach could be to implement better error handling within the function when checking for document existence, to prevent the async queue from stalling. This may involve optimizing the code to handle errors more efficiently, reducing the load on the system when processing tens of thousands of checks and potential failures.
Steven
13 Jul, 2024, 03:58

Async functions work via a queue. Is your first execution still executing?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more