Back

App1.4.2/Function/Execution Order || Priority

  • 0
  • Self Hosted
  • Functions
Elie Waked
13 Sep, 2023, 04:37

Hello Appwriters! I would like to know if there is a way to prioritize Function execution or set a priority for the execution; like rules in firewalls....

if not, what is the current execution order set by the engine... to overide that, i have create a sleep funtion in each function i need to delay its execution! Thanks

TL;DR
The user is asking about function execution order and priorities in App1.4.2. They have two functions: one for validation and one for pushing/logs. They are facing an issue where the log function writes both transactions with a "Completed" status instead of the first one being "Pending." They mention injecting a sleep function to prioritize the functions. They also ask if there is a way to set a priority for function execution or if there is a default execution order. Solution: The user resolved the issue by moving the log function to be the first installed function. However, they are still unsure about the execution order under high load and
Elie Waked
13 Sep, 2023, 04:41

i just test the deployment order and it looks like the first deployed will be at a higher execution priority, please confirm on server high load and high traffic will be consistent or shall i consider sleep function.

Drake
13 Sep, 2023, 05:20

I wouldn't rely on that. What do you need?

Elie Waked
13 Sep, 2023, 07:52

i have function to validate financial transactions and another one for push notification and client side logs... the fact is on event trigger in the financial transaction i m listen to creat and update and the log should listen to those transaction to logs them... creat then update the same document => the log will be written with the last doc status.. i need the first one is Pending until is Completed...

i have a payment gateway on the server side; if the admin allows auto funding for the user the payement will be processed and credit to the client account directly if not it will be pending until review and approval. the pay triggers => Pending status the approve triggers => Completed status

the issue is the logs function is writing both transaction with Completed ... and not having the time to bind the first one and inject the second one.

Elie Waked
13 Sep, 2023, 07:54

check the transaction is injected in the logs twice as completed when i move the logs function at first installed function this is resolved.. i beleive i have to inject a sleep function in all the function according to their prioritiy

Drake
13 Sep, 2023, 19:32

sorry im a little lost between the functions, logs, etc.

Drake
13 Sep, 2023, 19:36

so you have two functions:

  1. validate - triggers on document create/update, validates stuff, and then updates the document
  2. push/log - triggers on document create/update and pushes/logs

is that right?

Elie Waked
14 Sep, 2023, 05:22

No worries at all, your support is highly valuable. Yes this is exactly what i have

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