forked from 0x2620/pandora
s/taskId/id/
This commit is contained in:
parent
a0fc6ffadc
commit
b010aca0a9
2 changed files with 9 additions and 7 deletions
|
@ -344,17 +344,19 @@ def getTaskStatus(request, data):
|
|||
'''
|
||||
Gets the status for a given task
|
||||
takes {
|
||||
taskId: string // taskId
|
||||
id: string // taskId
|
||||
}
|
||||
returns {
|
||||
taskId: string, // taskId
|
||||
id: string, // taskId
|
||||
status: string, // status, 'PENDING' or 'OK'
|
||||
result: object // result data
|
||||
}
|
||||
notes: To be deprecated, will be wrapped in regular API call.
|
||||
'''
|
||||
#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']
|
||||
else:
|
||||
task_id = data['task_id']
|
||||
|
|
|
@ -2645,14 +2645,14 @@ pandora.updateStatus = function(item) {
|
|||
}
|
||||
};
|
||||
|
||||
pandora.wait = function(taskId, callback, timeout) {
|
||||
pandora.wait = function(id, callback, timeout) {
|
||||
var task = {};
|
||||
timeout = timeout || 5000;
|
||||
task.timeout = setTimeout(function() {
|
||||
pandora.api.getTaskStatus({taskId: taskId}, function(result) {
|
||||
pandora.api.getTaskStatus({id: id}, function(result) {
|
||||
var t;
|
||||
if (result.data.status == 'PENDING') {
|
||||
t = pandora.wait(taskId, callback);
|
||||
t = pandora.wait(id, callback);
|
||||
task.timeout = t.timeout;
|
||||
} else {
|
||||
callback(result);
|
||||
|
|
Loading…
Reference in a new issue