feat(core): Add debounced tasks and step-based progress tracking; upgrade deps and improve dashboard and scheduling
This commit is contained in:
33
readme.md
33
readme.md
@@ -162,9 +162,9 @@ console.log(`Saved ${savedCount} items`);
|
||||
Execute multiple tasks simultaneously:
|
||||
|
||||
```typescript
|
||||
import { TaskParallel } from '@push.rocks/taskbuffer';
|
||||
import { Taskparallel } from '@push.rocks/taskbuffer';
|
||||
|
||||
const parallel = new TaskParallel({
|
||||
const parallel = new Taskparallel({
|
||||
name: 'ParallelProcessor',
|
||||
tasks: [
|
||||
emailTask,
|
||||
@@ -179,6 +179,29 @@ const results = await parallel.trigger(notificationData);
|
||||
// results = [emailResult, smsResult, pushResult, webhookResult]
|
||||
```
|
||||
|
||||
### Debounced Tasks - Smart Trigger Coalescing
|
||||
|
||||
Coalesce rapid triggers into a single execution after a quiet period:
|
||||
|
||||
```typescript
|
||||
import { TaskDebounced } from '@push.rocks/taskbuffer';
|
||||
|
||||
const searchTask = new TaskDebounced({
|
||||
name: 'SearchQuery',
|
||||
debounceTimeInMillis: 300, // Wait 300ms after last trigger
|
||||
taskFunction: async (query) => {
|
||||
const results = await searchAPI(query);
|
||||
return results;
|
||||
}
|
||||
});
|
||||
|
||||
// Rapid typing - only the last query executes
|
||||
searchTask.trigger('h');
|
||||
searchTask.trigger('he');
|
||||
searchTask.trigger('hel');
|
||||
searchTask.trigger('hello'); // Only this one executes after 300ms pause
|
||||
```
|
||||
|
||||
### TaskManager - Centralized Orchestration
|
||||
|
||||
Manage all your tasks from a single point:
|
||||
@@ -559,9 +582,11 @@ logger.level = 'debug';
|
||||
- **`Task<T, TSteps>`** - Basic task unit with optional step tracking
|
||||
- **`TaskManager`** - Central orchestrator for task management
|
||||
- **`Taskchain`** - Sequential task executor
|
||||
- **`TaskParallel`** - Concurrent task executor
|
||||
- **`Taskparallel`** - Concurrent task executor
|
||||
- **`TaskOnce`** - Single-execution task
|
||||
- **`TaskLoop`** - Repeating task with conditions
|
||||
- **`TaskDebounced`** - Debounced task that waits for a pause in triggers
|
||||
- **`TaskRunner`** - Sequential task runner with scheduling support
|
||||
- **`distributedCoordination`** - Namespace for distributed task coordination
|
||||
|
||||
### Key Methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user