Update task.js

This commit is contained in:
Namhyeon Go 2021-06-23 14:20:45 +09:00 committed by GitHub
parent 7656327a76
commit 4c0b5f8946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,7 @@ var TaskQueue = function() {
};
this.next = function() {
var result = null;
try {
var task = this.get();
@ -88,8 +88,9 @@ var TaskQueue = function() {
this.run = function() {
this._keepalive = true;
while(this._keepalive) {
var now = new Date().getTime();
this.next();
sleep(100);
sleep(1);
}
};
this.stop = function() {
@ -133,4 +134,25 @@ exports.run = function(q) {
exports.stop = function(q) {
q.stop();
}
};
/*
exports.setTimeout = function() {
var f = null;
var delay = 0;
var params = [];
if (arguments.length > 2) {
f = arguments[0];
delay = arguments[1];
params = arguments.slice(2);
} else if (arguments.length == 2) {
f = arguments[0];
delay = arguments[1];
}
if (f != null) {
}
};
*/