How to use the queue.Task function in queue

To help you get started, we’ve selected a few queue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tilemill-project / tilemill / server / jobtasks.js View on Github external
var ExportJobImage = function(model, queue) {
    var task = new Task();
    task.on('start', function() {
        this.emit('work');
    });
    task.on('work', function() {
        Step(
            function() {
                path.exists(path.join(settings.export_dir, model.get('filename')), this);
            },
            function(exists) {
                if (exists) {
                    var filename = model.get('filename');
                    var extension = path.extname(filename);
                    var date = new Date();
                    var hash = require('crypto').createHash('md5')
                        .update(date.getTime()).digest('hex').substring(0,6);
                    model.set({