i have the following problem. When i have the scheduler enabled in an extension, my users get kicked after 4 minutes... here is the code i use:
Code: Select all
function init()
{
dbase = _server.getDatabaseManager()
globalUsers = []
scheduler = new _scheduler.Scheduler()
// Start the scheduler
scheduler.startService()
/*
* The Task object describes the task to be executed
* You can pass any object in the constructor, containing any custom parameters
*/
var task1 = new _scheduler.Task( {name:"updateUserLists"} )
/*
* This is the object that handles the call-backs generated by the Scheduler
* when it's time to execute the task.
*
* The object must implement a method called doTask which receives a Task object
* as the argument.
*/
var handlerObj = {}
handlerObj.count = 0
handlerObj.doTask = function(task)
{
getAllUsers(0);
var recipents = [];
var zone = _server.getCurrentZone();
var foyer = zone.getRoomByName("allFoyer");
var userList = foyer.getAllUsers()
for (var j in userList) {
recipients.push(userList[j])
}
var users = globalUsers;
var responseObj = {}
responseObj._cmd = "getAllUsers"
responseObj.users = users;
_server.sendResponse(responseObj, -1, null, recipients);
}
// We create the call-back handler
var taskHandler = new _scheduler.ITaskHandler( handlerObj )
/*
* Here we add the tasks to the scheduler
* specifiying the delay interval (2nd param) in seconds
* if the task loops (3rd param)
* and the call-back handler (4th param)
*/
scheduler.addScheduledTask(task1, 3, true, taskHandler)
}
peace
Daniel