Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 1x | import { jobsManager } from './job-manager.js';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* Get the absolute path to a compiled job file.
* In production, jobs are in dist/jobs/*.js
*/
function getJobPath(filename) {
return path.join(__dirname, filename);
}
/**
* Create a thumbnail image from a source file.
* Uses shared background job to avoid duplicate work.
*/
export function createThumbnailJob(src, dest) {
const params = { src, dest };
return jobsManager.runSharedBackgroundJob(`create-thumbnail-job:${src}->${dest}`, getJobPath('create-thumbnail-job.js'), params);
}
/**
* Run a glob pattern match to find files.
* Each call runs in its own worker thread.
*/
export function globJob(expression, options) {
const params = { expression, options };
return jobsManager.runBackgroundJob(`glob-job:${expression}(${JSON.stringify(options)})`, getJobPath('glob-job.js'), params);
}
/**
* Fetch and validate community templates from the Quiqr repository.
* Each call runs in its own worker thread.
*/
export function updateCommunityTemplatesJob() {
return jobsManager.runBackgroundJob('update-community-templates-job', getJobPath('update-community-templates-job.js'));
}
// Export the manager and types
export { jobsManager, JobsManager } from './job-manager.js';
export { BackgroundJobRunner } from './background-job-runner.js';
|