Skip to main content

Async Tasks

Async tasks allow you to execute pieces of code asynchronously, enabling non-blocking execution and improving the overall responsiveness and scalability of your application. These tasks can be triggered in two main ways: through direct invocation or by scheduling them to run at specified intervals.

Direct Invocation of Async Tasks

One way to execute asynchronous tasks is by invoking them directly within your codebase. This approach is useful for handling tasks that need to be performed asynchronously without delaying the execution of the main code flow. By offloading these tasks to run asynchronously, you can ensure that your application remains responsive and efficient.

Scheduled Execution of Async Tasks

Another method for executing asynchronous tasks is by scheduling them to run at predefined intervals. This approach is beneficial for tasks that need to be performed periodically, such as background data synchronization, cleanup processes, or recurring calculations. By scheduling tasks to run automatically at specified times or intervals, you can automate routine operations and maintain the health and efficiency of your application.