// CPU-intensive tasks
const analyzeData = hy.task({
name: 'analyzeData',
config: {
queue: 'cpu-intensive',
timeoutSeconds: 600
},
func: async (data) => {
// Complex calculations
return { analyzed: true };
}
});
// I/O-bound tasks
const fetchExternalData = hy.task({
name: 'fetchExternalData',
config: {
queue: 'io-bound',
maxRetries: 5
},
func: async (data) => {
// External API calls
return { fetched: true };
}
});
// Memory-intensive tasks
const processLargeFile = hy.task({
name: 'processLargeFile',
config: {
queue: {
name: 'memory-intensive',
concurrencyLimit: 1 // Prevent OOM
}
},
func: async (data) => {
// Large file processing
return { processed: true };
}
});