Async Task Pattern

•
777
•

Implements an asynchronous task state machine to prevent gateway timeouts and handle long-running operations efficiently.

This skill provides a robust blueprint for handling backend operations that exceed 10 seconds, such as batch data processing, cross-tenant aggregation, or remote API calls. It guides developers in transitioning from blocking synchronous calls to an asynchronous trigger-and-poll pattern, effectively preventing 504 gateway timeouts, duplicate triggers, and memory leaks. The skill includes specific implementation patterns for Java/Spring backends—including thread-local context propagation—and standardized UX guidelines for frontend polling and progress visualization.

Key Features

01Thread-safe execution with automated TenantContext/MDC propagation
02777 GitHub stars
03Standardized triggerAsync and getStatus state machine templates
04Duplicate trigger prevention for concurrent user requests
05Frontend polling and UX best practices for long-running tasks
06Memory leak prevention via TTL and LRU cache eviction strategies

Use Cases

01Processing batch data imports or exports involving thousands of records
02Executing slow remote API calls that risk 30-second gateway timeouts
03Implementing reliable progress tracking for complex background jobs