@huylv What's the SDK you're using?
I used "node-appwrite": "^9.0.0" to write cloud functions
Then you should list executions this way:
const promise = functions.listExecutions('[FUNCTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
my implementation:
const executions = await Appwrite.functions.listExecutions(createOrderFunctionId, [
Query.equal("status", "waiting"),
Query.equal("status", "processing"),
])
they are the same @D5
what wrong with my query?
Check if there is any log in the container: appwrite-worker-functions
I found this log about this function
what about docker compose logs appwrite?
error no configuration file provided: not found
can you show the complete log?
there is no log, docker compose logs appwrite show that error
If there is no solution, it's hard to use appwrite on production 😦
Did you have set in your appwrite instance an API key?
I will also need to do a similar implementation
You essentially need to create a lock. You can do this by creating a locks collection. When a user executes the create order function, it'll create a document in the locks collection with ID of the user. If the document is created successfully, it'll continue to process the order. Before the function finishes, it must delete the document to release the lock.
Seems like the other functions will get executed before the document has been created.
What do you mean?
The user is checking if an element already exists in database, I think that should not be different from creating a lock collection. The problem is that the first function creates the element so other run simultaneously will not "see" the firstly created document.
I wasn't suggesting to check for a document. The first execution will create the document. If another execution tries to run at the same time, the create document will fail so the function will exit
@huylv Then try this
I will try too next week
I tried and it worked as expected. Thanks Steven and D5, but is this a formal way to achieve this. I though Database transaction is the solution for almost project
feel free to 👍🏼 this issue for transactions: https://github.com/appwrite/appwrite/issues/2788
[SOLVED] Prevent cheater from spam execute function
Recommended threads
- Confusion around Tables / TablesDB vs Da...
Hello everyone, I ran into quite a bit of confusion when trying to migrate a Function from Databases.createDocument() to the new Tables / Rows API and wanted t...
- No permissions provided for action 'read...
I have a very weird error; In a function I'm using dynamic keys to perform read write operation in rows. I have the scopes for read and write rows. The funct...
- Repository directory size should be less...
Whenever I create a function i get the error above. Is there a way to get around this? How do I fix this?