s/taskId/id/

This commit is contained in:
j 2016-06-15 15:45:51 +02:00
parent a0fc6ffadc
commit b010aca0a9
2 changed files with 9 additions and 7 deletions

View file

@ -344,17 +344,19 @@ def getTaskStatus(request, data):
''' '''
Gets the status for a given task Gets the status for a given task
takes { takes {
taskId: string // taskId id: string // taskId
} }
returns { returns {
taskId: string, // taskId id: string, // taskId
status: string, // status, 'PENDING' or 'OK' status: string, // status, 'PENDING' or 'OK'
result: object // result data result: object // result data
} }
notes: To be deprecated, will be wrapped in regular API call. notes: To be deprecated, will be wrapped in regular API call.
''' '''
#FIXME: should check if user has permissions to get status #FIXME: should check if user has permissions to get status
if 'taskId' in data: if 'id' in data:
task_id = data['id']
elif 'taskId' in data:
task_id = data['taskId'] task_id = data['taskId']
else: else:
task_id = data['task_id'] task_id = data['task_id']

View file

@ -2645,14 +2645,14 @@ pandora.updateStatus = function(item) {
} }
}; };
pandora.wait = function(taskId, callback, timeout) { pandora.wait = function(id, callback, timeout) {
var task = {}; var task = {};
timeout = timeout || 5000; timeout = timeout || 5000;
task.timeout = setTimeout(function() { task.timeout = setTimeout(function() {
pandora.api.getTaskStatus({taskId: taskId}, function(result) { pandora.api.getTaskStatus({id: id}, function(result) {
var t; var t;
if (result.data.status == 'PENDING') { if (result.data.status == 'PENDING') {
t = pandora.wait(taskId, callback); t = pandora.wait(id, callback);
task.timeout = t.timeout; task.timeout = t.timeout;
} else { } else {
callback(result); callback(result);