-
Notifications
You must be signed in to change notification settings - Fork 11
/
server-job-background.js
26 lines (23 loc) · 1.05 KB
/
server-job-background.js
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
"use strict";
var util = require('util');
var events = require('events');
var stream = require('readable-stream');
var StreamReplay = require('./stream-replay');
var through = require('through2');
var MultiJob = require('./server-job-multi');
var BgJob = module.exports = function (id, func, uniqueid, priority, body) {
MultiJob.call(this, id, func, uniqueid, priority, body);
this.background = true;
}
util.inherits( BgJob, MultiJob );
BgJob.prototype.addClient = function(client) { }
BgJob.prototype.removeClient = function(client) { }
BgJob.prototype.sendWorkComplete = function(body) { body.resume(); this.emit('job-complete') }
BgJob.prototype.sendWorkData = function(body) { body.resume() }
BgJob.prototype.sendWorkWarning = function(body) { body.resume() }
BgJob.prototype.sendWorkException = function(body) { body.resume(); this.emit('job-complete') }
BgJob.prototype.sendWorkFail = function(body) { body.resume(); this.emit('job-complete') }
BgJob.prototype.sendWorkStatus = function(complete,total) {
this.complete = complete;
this.total = total;
}