Back

How to Avoid Double Requests in functions.createExecution?

  • 0
  • Databases
  • Functions
  • Web
Morel
14 Dec, 2024, 05:19

I'm currently using Appwrite's functions.createExecution in my project. I want to avoid double requests when multiple actions (like searching or pagination) are triggered in quick succession.

When using fetch, I usually rely on AbortController with a signal to handle this. However, I'm unsure how to implement a similar approach with functions.createExecution.

Here's an example of the code I’m using:

TypeScript
const result = await functions.createExecution(
    "name_function",
    undefined,
    false,
    `/path-to-function`,
    ExecutionMethod.GET
);
TL;DR
Issue: Developer using Appwrite's `functions.createExecution` wants to prevent double requests when multiple actions occur in quick succession like searching or pagination. Solution: To avoid double requests, developers can create a mechanism to track and prevent concurrent executions. One possible approach is to set a flag or use a queue system to manage the execution flow and prevent multiple calls to `functions.createExecution`. This can help ensure that only one request is processed at a time, avoiding duplication of actions.
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