Commit 028cbd19 authored by Tristan Cavelier's avatar Tristan Cavelier

Fix bug: wait status now can use job manager correctly

parent fd87000b
...@@ -705,7 +705,7 @@ var waitStatus = function(spec, my) { ...@@ -705,7 +705,7 @@ var waitStatus = function(spec, my) {
priv.refreshJobIdArray = function() { priv.refreshJobIdArray = function() {
var tmp_job_id_array = [], i; var tmp_job_id_array = [], i;
for (i = 0; i < priv.job_id_array.length; i+= 1) { for (i = 0; i < priv.job_id_array.length; i+= 1) {
if (my.jobManager.jobIdExists(priv.job_id_array[i])) { if (jobManager.jobIdExists(priv.job_id_array[i])) {
tmp_job_id_array.push(priv.job_id_array[i]); tmp_job_id_array.push(priv.job_id_array[i]);
} }
} }
......
/*! JIO - v0.1.0 - 2012-08-21 /*! JIO - v0.1.0 - 2012-08-21
* Copyright (c) 2012 Nexedi; Licensed */ * Copyright (c) 2012 Nexedi; Licensed */
var jio=function(){"use strict";var a=function(a,b){var c={};return a=a||{},b=b||{},c.name="jioException",c.message=a.message||"Unknown Reason.",c.toString=function(){return c.name+": "+c.message},c},b=function(b,c){var d=a(b,c);b=b||{};var e=b.command;return d.name="invalidCommandState",d.toString=function(){return d.name+": "+e.getLabel()+", "+d.message},d},c=function(b,c){var d=a(b,c);b=b||{};var e=b.storage.getType();return d.name="invalidStorage",d.toString=function(){return d.name+": "+'Type "'+e+'", '+d.message},d},d=function(b,c){var d=a(b,c),e=b.type;return d.name="invalidStorageType",d.toString=function(){return d.name+": "+e+", "+d.message},d},e=function(b,c){var d=a(b,c);return d.name="jobNotReadyException",d},f=function(b,c){var d=a(b,c);return d.name="tooMuchTriesJobException",d},g=function(b,c){var d=a(b,c);return d.name="invalidJobException",d},h=function(a){var b=function(a,b){var d={};a=a||{},b=b||{};var e={};return e.type=a.type||"",Object.defineProperty(d,"getType",{configurable:!1,enumerable:!1,writable:!1,value:function(){return e.type}}),d.execute=function(a){d.success=a.success,d.error=a.error,d.retry=a.retry,d.end=a.end,d.validate(a)&&a.executeOn(d)},d.isValid=function(){return!0},d.validate=function(){var a=d.validateState();return a?(d.error({status:0,statusText:"Invalid Storage",error:"invalid_storage",message:a,reason:a}),!1):!0},d.serialized=function(){return{type:d.getType()}},d.saveDocument=function(a){d.error({status:0,statusText:"Unknown storage",error:"unknown_storage",message:"Unknown Storage"})},d.loadDocument=function(a){d.saveDocument()},d.removeDocument=function(a){d.saveDocument()},d.getDocumentList=function(a){d.saveDocument()},d.validateState=function(){return""},d.success=function(){},d.retry=function(){},d.error=function(){},d.end=function(){},e.newCommand=function(a,d){var e=d||{};return e.label=a,c(e,b)},d.addJob=function(a,c,d,f,g,h){var i={options:f,callbacks:{success:g,error:h}};d&&(a==="get"?i.docid=d:i.doc=d),y.addJob(t({storage:b.storage(c||{}),command:e.newCommand(a,i)},b))},d},c=function(a,b){var d={};a=a||{},b=b||{};var e={};return e.commandlist={post:m,put:l,get:j,remove:k,allDocs:h},a.label&&e.commandlist[a.label]?(e.label=a.label,delete a.label,e.commandlist[e.label](a,b)):(e.tried=0,e.doc=a.doc||{},e.docid=a.docid||"",e.option=a.options||{},e.callbacks=a.callbacks||{},e.success=e.callbacks.success||function(){},e.error=e.callbacks.error||function(){},e.retry=function(){d.error({status:13,statusText:"Fail Retry",error:"fail_retry",message:"Impossible to retry.",reason:"Impossible to retry."})},e.end=function(){},e.on_going=!1,d.serialized=function(){return{label:d.getLabel(),tried:e.tried,doc:d.cloneDoc(),option:d.cloneOption()}},d.getLabel=function(){return"command"},d.getDocId=function(){return e.docid||e.doc._id},d.getDocContent=function(){return e.doc.content},d.getDocInfo=function(a){return e.doc[a]},d.getOption=function(a){return e.option[a]},d.validate=function(a){return d.validateState()?a.validate():!1},d.validateState=function(){return typeof e.doc!="object"?(d.error({status:20,statusText:"Document_Id Required",error:"document_id_required",message:"No document id.",reason:"no document id"}),!1):!0},d.canBeRetried=function(){return typeof e.option.max_retry=="undefined"||e.option.max_retry===0||e.tried<e.option.max_retry},d.getTried=function(){return e.tried},d.execute=function(a){e.on_going||d.validate(a)&&(e.tried++,e.on_going=!0,a.execute(d))},d.executeOn=function(a){},d.success=function(a){e.on_going=!1,e.success(a),e.end(o())},d.retry=function(a){e.on_going=!1,d.canBeRetried()?e.retry():d.error(a)},d.error=function(a){e.on_going=!1,e.error(a),e.end(p())},d.end=function(){e.end(o())},d.onSuccessDo=function(a){if(a)e.success=a;else return e.success},d.onErrorDo=function(a){if(a)e.error=a;else return e.error},d.onEndDo=function(a){e.end=a},d.onRetryDo=function(a){e.retry=a},d.canBeRestored=function(){return!0},d.clone=function(){return c(d.serialized(),b)},d.cloneOption=function(){var a,b={};for(a in e.option)b[a]=e.option[a];return b},d.cloneDoc=function(){if(e.docid)return e.docid;var a,b={};for(a in e.doc)b[a]=e.doc[a];return b},d)},h=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"allDocs"},d.executeOn=function(a){a.allDocs(d)},d.canBeRestored=function(){return!1},d},j=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"get"},d.validateState=function(){return d.getDocId()?!0:(d.error({status:20,statusText:"Document Id Required",error:"document_id_required",message:"No document id.",reason:"no document id"}),!1)},d.executeOn=function(a){a.get(d)},d.canBeRestored=function(){return!1},d},k=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"remove"},d.executeOn=function(a){a.remove(d)},d},l=function(a,b){var d=c(a,b);a=a||{},b=b||{};var e={};d.getLabel=function(){return"put"};var f=d.validateState;return d.validate=function(){return typeof d.getDocInfo("content")!="string"?(d.error({status:21,statusText:"Content Required",error:"content_required",message:"No data to put.",reason:"no data to put"}),!1):f()},d.executeOn=function(a){a.put(d)},d},m=function(a,b){var d=c(a,b);a=a||{},b=b||{};var e={};d.getLabel=function(){return"post"};var f=d.validateState;return d.validate=function(){return typeof d.getDocInfo("content")!="string"?(d.error({status:21,statusText:"Content Required",error:"content_required",message:"No data to put.",reason:"no data to put"}),!1):f()},d.executeOn=function(a){a.put(d)},d},n=function(a,b){var c={};return a=a||{},b=b||{},c.getLabel=function(){return"job status"},c.canStart=function(){},c.canRestart=function(){},c.serialized=function(){return{label:c.getLabel()}},c.isWaitStatus=function(){return!1},c.isDone=function(){return!1},c},o=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"done"},c.canStart=function(){return!1},c.canRestart=function(){return!1},c.isDone=function(){return!0},c},p=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"fail"},c.canStart=function(){return!1},c.canRestart=function(){return!0},c},q=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"initial"},c.canStart=function(){return!0},c.canRestart=function(){return!0},c},r=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"on going"},c.canStart=function(){return!1},c.canRestart=function(){return!1},c},s=function(a,b){var c=n(a,b);a=a||{},b=b||{};var d={};return d.job_id_array=a.job_id_array||[],d.threshold=0,c.getLabel=function(){return"wait"},d.refreshJobIdArray=function(){var a=[],c;for(c=0;c<d.job_id_array.length;c+=1)b.jobManager.jobIdExists(d.job_id_array[c])&&a.push(d.job_id_array[c]);d.job_id_array=a},c.waitForJob=function(a){var b;for(b=0;b<d.job_id_array.length;b+=1)if(d.job_id_array[b]===a.getId())return;d.job_id_array.push(a.getId())},c.dontWaitForJob=function(a){var b,c=[];for(b=0;b<d.job_id_array.length;b+=1)d.job_id_array[b]!==a.getId()&&c.push(d.job_id_array[b]);d.job_id_array=c},c.waitForTime=function(a){d.threshold=Date.now()+a},c.stopWaitForTime=function(){d.threshold=0},c.canStart=function(){return d.refreshJobIdArray(),d.job_id_array.length===0&&Date.now()>=d.threshold},c.canRestart=function(){return c.canStart()},c.serialized=function(){return{label:c.getLabel(),waitfortime:d.threshold,waitforjob:d.job_id_array}},c.isWaitStatus=function(){return!0},c},t=function(a){var b={};a=a||{};var c={};c.id=x.nextId(),c.command=a.command,c.storage=a.storage,c.status=q(),c.date=new Date;if(!c.storage)throw g({job:b,message:"No storage set"});if(!c.command)throw g({job:b,message:"No command set"});return b.getCommand=function(){return c.command},b.getStatus=function(){return c.status},b.getId=function(){return c.id},b.getStorage=function(){return c.storage},b.getDate=function(){return c.date},b.isReady=function(){return c.command.getTried()===0?c.status.canStart():c.status.canRestart()},b.serialized=function(){return{id:c.id,date:c.date.getTime(),status:c.status.serialized(),command:c.command.serialized(),storage:c.storage.serialized()}},b.waitForJob=function(a){c.status.getLabel()!=="wait"&&(c.status=s({})),c.status.waitForJob(a)},b.dontWaitFor=function(a){c.status.getLabel()==="wait"&&c.status.dontWaitForJob(a)},b.waitForTime=function(a){c.status.getLabel()!=="wait"&&(c.status=s({})),c.status.waitForTime(a)},b.stopWaitForTime=function(){c.status.getLabel()==="wait"&&c.status.stopWaitForTime()},b.eliminated=function(){c.command.error({status:10,statusText:"Stopped",error:"stopped",message:"This job has been stopped by another one.",reason:"this job has been stopped by another one"})},b.notAccepted=function(){c.command.onEndDo(function(){c.status=p(),y.terminateJob(b)}),c.command.error({status:11,statusText:"Not Accepted",error:"not_accepted",message:"This job is already running.",reason:"this job is already running"})},b.update=function(a){c.command.error({status:12,statusText:"Replaced",error:"replaced",message:"Job has been replaced by another one.",reason:"job has been replaced by another one"}),c.date=new Date(a.getDate().getTime()),c.command=a.getCommand(),c.status=a.getStatus()},b.execute=function(){if(!b.getCommand().canBeRetried())throw f({job:b,message:"The job was invoked too much time."});if(!b.isReady())throw e({job:b,message:"Can not execute this job."});c.status=r(),c.command.onRetryDo(function(){var a=c.command.getTried();a=a*a*200,a>1e4&&(a=1e4),b.waitForTime(a)}),c.command.onEndDo(function(a){c.status=a,y.terminateJob(b)}),c.command.execute(c.storage)},b},u=function(a,b){var c={};a=a||{},b=b||{};var d=[],e=a.name||"",f=a.announcer||{};return c.add=function(a){d.push(a)},c.remove=function(a){var b,c=[];for(b=0;b<d.length;b+=1)d[b]!==a&&c.push(d[b]);d=c},c.register=function(){f.register(c)},c.unregister=function(){f.unregister(c)},c.trigger=function(a){var b;for(b=0;b<d.length;b++)d[b].apply(null,a)},c},v=function(a,b){var c={};a=a||{},b=b||{};var d={};return d.id=a.id||0,d.interval=400,d.interval_id=null,d.touch=function(){LocalOrCookieStorage.setItem("jio/id/"+d.id,Date.now())},c.setId=function(a){d.id=a},c.setIntervalDelay=function(a){d.interval=a},c.getIntervalDelay=function(){return d.interval},c.start=function(){d.interval_id||(d.touch(),d.interval_id=setInterval(function(){d.touch()},d.interval))},c.stop=function(){d.interval_id!==null&&(clearInterval(d.interval_id),d.interval_id=null)},c}(),w=function(a,b){var c={};a=a||{},b=b||{};var d={};return c.register=function(a){d[a]||(d[a]=u())},c.unregister=function(a){d[a]&&delete d[a]},c.at=function(a){return d[a]},c.on=function(a,b){c.register(a),c.at(a).add(b)},c.trigger=function(a,b){c.at(a).trigger(b)},c}(),x=function(a){var b={};a=a||{};var c=0;return b.nextId=function(){return c=c+1,c},b}(),y=function(a){var b={};a=a||{};var d="jio/job_array",e={};return e.id=a.id,e.interval_id=null,e.interval=200,e.job_array=[],e.getJobArrayName=function(){return d+"/"+e.id},e.getJobArray=function(){return LocalOrCookieStorage.getItem(e.getJobArrayName())||[]},e.copyJobArrayToLocal=function(){var a=[],b;for(b=0;b<e.job_array.length;b+=1)a.push(e.job_array[b].serialized());LocalOrCookieStorage.setItem(e.getJobArrayName(),a)},e.removeJob=function(a){var b,c=[];for(b=0;b<e.job_array.length;b+=1)e.job_array[b]!==a&&c.push(e.job_array[b]);e.job_array=c,e.copyJobArrayToLocal()},b.setId=function(a){e.id=a},b.start=function(){var a;e.interval_id===null&&(e.interval_id=setInterval(function(){e.restoreOldJio();for(a=0;a<e.job_array.length;a+=1)b.execute(e.job_array[a])},e.interval))},b.stop=function(){e.interval_id!==null&&(clearInterval(e.interval_id),e.interval_id=null,e.job_array.length===0&&LocalOrCookieStorage.deleteItem(e.getJobArrayName()))},e.restoreOldJio=function(){var a,b;e.lastrestore=e.lastrestore||0;if(e.lastrestore>Date.now()-2e3)return;b=LocalOrCookieStorage.getItem("jio/id_array")||[];for(a=0;a<b.length;a+=1)e.restoreOldJioId(b[a]);e.lastrestore=Date.now()},e.restoreOldJioId=function(a){var b;b=LocalOrCookieStorage.getItem("jio/id/"+a)||0,(new Date(b)).getTime()<Date.now()-1e4&&(e.restoreOldJobFromJioId(a),e.removeOldJioId(a),e.removeJobArrayFromJioId(a))},e.restoreOldJobFromJioId=function(a){var d,e;e=LocalOrCookieStorage.getItem("jio/job_array/"+a)||[];for(d=0;d<e.length;d+=1){var f=c(e[d].command);f.canBeRestored()&&b.addJob(t({storage:b.storage(e[d].storage),command:f}))}},e.removeOldJioId=function(a){var b,c,d=[];c=LocalOrCookieStorage.getItem("jio/id_array")||[];for(b=0;b<c.length;b+=1)c[b]!==a&&d.push(c[b]);LocalOrCookieStorage.setItem("jio/id_array",d),LocalOrCookieStorage.deleteItem("jio/id/"+a)},e.removeJobArrayFromJioId=function(a){LocalOrCookieStorage.deleteItem("jio/job_array/"+a)},b.execute=function(a){try{a.execute()}catch(b){switch(b.name){case"jobNotReadyException":break;case"tooMuchTriesJobException":break;default:throw b}}e.copyJobArrayToLocal()},b.jobIdExists=function(a){var b;for(b=0;b<e.job_array.length;b+=1)if(e.job_array[b].getId()===a)return!0;return!1},b.terminateJob=function(a){e.removeJob(a)},b.addJob=function(a){var c=b.validateJobAccordingToJobList(e.job_array,a);e.appendJob(a,c)},b.validateJobAccordingToJobList=function(a,b){var c,d=[];for(c=0;c<a.length;c+=1)d.push(z.validateJobAccordingToJob(a[c],b));return d},e.appendJob=function(a,b){var c;if(e.job_array.length!==b.length)throw new RangeError("Array out of bound");for(c=0;c<b.length;c+=1)if(b[c].action==="dont accept")return a.notAccepted();for(c=0;c<b.length;c+=1)switch(b[c].action){case"eliminate":b[c].job.eliminated(),e.removeJob(b[c].job);break;case"update":b[c].job.update(a),e.copyJobArrayToLocal();return;case"wait":a.waitForJob(b[c].job);break;default:}e.job_array.push(a),e.copyJobArrayToLocal()},b.serialized=function(){var a=[],b,c=e.job_array||[];for(b=0;b<c.length;b+=1)a.push(c[b].serialized());return a},b}(),z=function(a){var b={},c={};return c.compare={},c.action={},Object.defineProperty(b,"eliminate",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"eliminate"}}),Object.defineProperty(b,"update",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"update"}}),Object.defineProperty(b,"dontAccept",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"dont accept"}}),Object.defineProperty(b,"wait",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"wait"}}),Object.defineProperty(b,"none",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"none"}}),b.default_action=b.none,b.default_compare=function(a,b){return a.getCommand().getDocId()===b.getCommand().getDocId()&&a.getCommand().getDocInfo("_rev")===b.getCommand().getDocInfo("_rev")&&a.getCommand().getOption("rev")===b.getCommand().getOption("rev")&&JSON.stringify(a.getStorage().serialized())===JSON.stringify(b.getStorage().serialized())},c.getAction=function(a,d){var e,f,g;return e=a.getCommand().getLabel(),f=d.getCommand().getLabel(),g=a.getStatus().getLabel()==="on going"?"on going":"not on going",c.action[e]&&c.action[e][g]&&c.action[e][g][f]?c.action[e][g][f](a,d):b.default_action(a,d)},c.canCompare=function(a,d){var e=a.getCommand().getLabel(),f=d.getCommand().getLabel();return c.compare[e]&&c.compare[f]?c.compare[e][f](a,d):b.default_compare(a,d)},Object.defineProperty(b,"validateJobAccordingToJob",{configurable:!1,enumerable:!1,writable:!1,value:function(a,d){return c.canCompare(a,d)?{action:c.getAction(a,d),job:a}:{action:b.default_action(a,d),job:a}}}),Object.defineProperty(b,"addActionRule",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b,d,e){var f=b?"on going":"not on going";c.action[a]=c.action[a]||{},c.action[a][f]=c.action[a][f]||{},c.action[a][f][d]=e}}),Object.defineProperty(b,"addCompareRule",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b,d){c.compare[a]=c.compare[a]||{},c.compare[a][b]=d}}),b.addActionRule("put",!0,"put",function(a,c){return a.getCommand().getDocInfo("content")===c.getCommand().getDocInfo("content")?b.dontAccept():b.wait()}),b.addActionRule("put",!0,"get",b.wait),b.addActionRule("put",!0,"remove",b.wait),b.addActionRule("put",!1,"put",b.update),b.addActionRule("put",!1,"get",b.wait),b.addActionRule("put",!1,"remove",b.eliminate),b.addActionRule("get",!0,"put",b.wait),b.addActionRule("get",!0,"get",b.dontAccept),b.addActionRule("get",!0,"remove",b.wait),b.addActionRule("get",!1,"put",b.wait),b.addActionRule("get",!1,"get",b.update),b.addActionRule("get",!1,"remove",b.wait),b.addActionRule("remove",!0,"get",b.dontAccept),b.addActionRule("remove",!0,"remove",b.dontAccept),b.addActionRule("remove",!1,"put",b.eliminate),b.addActionRule("remove",!1,"get",b.dontAccept),b.addActionRule("remove",!1,"remove",b.update),b.addActionRule("allDocs",!0,"allDocs",b.dontAccept),b.addActionRule("allDocs",!1,"allDocs",b.update),b}(),A={},B={};a=a||{};var C="jio/id_array";return B.id=null,B.storage_spec=a,B.init=function(){if(B.id===null){var a,b=LocalOrCookieStorage.getItem(C)||[];B.id=1;for(a=0;a<b.length;a+=1)b[a]>=B.id&&(B.id=b[a]+1);b.push(B.id),LocalOrCookieStorage.setItem(C,b),v.setId(B.id),y.setId(B.id)}},Object.defineProperty(A,"storage",{configurable:!1,enumerable:!1,writable:!1,value:function(a,c,e){a=a||{},c=c||{},c.basicStorage=b,c.storage=A.storage;var f=e||a.type||"base";if(f==="base")return b(a,c);if(!i[f])throw d({type:f,message:"Storage does not exists."});return i[f](a,c)}}),y.storage=A.storage,Object.defineProperty(A,"start",{configurable:!1,enumerable:!1,writable:!1,value:function(){B.init(),v.start(),y.start()}}),Object.defineProperty(A,"stop",{configurable:!1,enumerable:!1,writable:!1,value:function(){y.stop()}}),Object.defineProperty(A,"close",{configurable:!1,enumerable:!1,writable:!1,value:function(){v.stop(),y.stop(),B.id=null}}),Object.defineProperty(A,"getId",{configurable:!1,enumerable:!1,writable:!1,value:function(){return B.id}}),Object.defineProperty(A,"getJobRules",{configurable:!1,enumerable:!1,writable:!1,value:function(){return z}}),Object.defineProperty(A,"validateStorageDescription",{configurable:!1,enumerable:!1,writable:!1,value:function(a){return A.storage(a).isValid()}}),Object.defineProperty(A,"getJobArray",{configurable:!1,enumerable:!1,writable:!1,value:function(){return y.serialized()}}),B.getParam=function(a,b){var c={},d=0;return b||(c.doc=a[d],d++),typeof a[d]=="object"?(c.options=a[d],d++):c.options={},c.callback=function(a,b){},c.success=function(a){c.callback(undefined,a)},c.error=function(a){c.callback(a,undefined)},typeof a[d]=="function"&&(typeof a[d+1]=="function"?(c.success=a[d],c.error=a[d+1]):c.callback=a[d]),c},B.addJob=function(a,b){y.addJob(t({storage:A.storage(B.storage_spec),command:a(b)}))},Object.defineProperty(A,"post",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(m,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"put",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(l,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"get",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||3,a.options.metadata_only=a.options.metadata_only!==undefined?a.options.metadata_only:!1,B.addJob(j,{docid:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"remove",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(k,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"allDocs",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments,"no doc");a.options.max_retry=a.options.max_retry||3,a.options.metadata_only=a.options.metadata_only!==undefined?a.options.metadata_only:!0,B.addJob(h,{options:a.options,callbacks:{success:a.success,error:a.error}})}}),A},i={base:function(){}},j=function(a){var b={};return a=a||{},Object.defineProperty(b,"newJio",{configurable:!1,enumerable:!1,writable:!1,value:function(a){var b=a,c=null;return typeof b=="string"&&(b=JSON.parse(b)),b=b||{type:"base"},c=h(a),c.start(),c}}),Object.defineProperty(b,"addStorageType",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b){b=b||function(){return null};if(i[a])throw d({type:a,message:"Already known."});i[a]=b}}),b}();return j}(); var jio=function(){"use strict";var a=function(a,b){var c={};return a=a||{},b=b||{},c.name="jioException",c.message=a.message||"Unknown Reason.",c.toString=function(){return c.name+": "+c.message},c},b=function(b,c){var d=a(b,c);b=b||{};var e=b.command;return d.name="invalidCommandState",d.toString=function(){return d.name+": "+e.getLabel()+", "+d.message},d},c=function(b,c){var d=a(b,c);b=b||{};var e=b.storage.getType();return d.name="invalidStorage",d.toString=function(){return d.name+": "+'Type "'+e+'", '+d.message},d},d=function(b,c){var d=a(b,c),e=b.type;return d.name="invalidStorageType",d.toString=function(){return d.name+": "+e+", "+d.message},d},e=function(b,c){var d=a(b,c);return d.name="jobNotReadyException",d},f=function(b,c){var d=a(b,c);return d.name="tooMuchTriesJobException",d},g=function(b,c){var d=a(b,c);return d.name="invalidJobException",d},h=function(a){var b=function(a,b){var d={};a=a||{},b=b||{};var e={};return e.type=a.type||"",Object.defineProperty(d,"getType",{configurable:!1,enumerable:!1,writable:!1,value:function(){return e.type}}),d.execute=function(a){d.success=a.success,d.error=a.error,d.retry=a.retry,d.end=a.end,d.validate(a)&&a.executeOn(d)},d.isValid=function(){return!0},d.validate=function(){var a=d.validateState();return a?(d.error({status:0,statusText:"Invalid Storage",error:"invalid_storage",message:a,reason:a}),!1):!0},d.serialized=function(){return{type:d.getType()}},d.saveDocument=function(a){d.error({status:0,statusText:"Unknown storage",error:"unknown_storage",message:"Unknown Storage"})},d.loadDocument=function(a){d.saveDocument()},d.removeDocument=function(a){d.saveDocument()},d.getDocumentList=function(a){d.saveDocument()},d.validateState=function(){return""},d.success=function(){},d.retry=function(){},d.error=function(){},d.end=function(){},e.newCommand=function(a,d){var e=d||{};return e.label=a,c(e,b)},d.addJob=function(a,c,d,f,g,h){var i={options:f,callbacks:{success:g,error:h}};d&&(a==="get"?i.docid=d:i.doc=d),y.addJob(t({storage:b.storage(c||{}),command:e.newCommand(a,i)},b))},d},c=function(a,b){var d={};a=a||{},b=b||{};var e={};return e.commandlist={post:m,put:l,get:j,remove:k,allDocs:h},a.label&&e.commandlist[a.label]?(e.label=a.label,delete a.label,e.commandlist[e.label](a,b)):(e.tried=0,e.doc=a.doc||{},e.docid=a.docid||"",e.option=a.options||{},e.callbacks=a.callbacks||{},e.success=e.callbacks.success||function(){},e.error=e.callbacks.error||function(){},e.retry=function(){d.error({status:13,statusText:"Fail Retry",error:"fail_retry",message:"Impossible to retry.",reason:"Impossible to retry."})},e.end=function(){},e.on_going=!1,d.serialized=function(){return{label:d.getLabel(),tried:e.tried,doc:d.cloneDoc(),option:d.cloneOption()}},d.getLabel=function(){return"command"},d.getDocId=function(){return e.docid||e.doc._id},d.getDocContent=function(){return e.doc.content},d.getDocInfo=function(a){return e.doc[a]},d.getOption=function(a){return e.option[a]},d.validate=function(a){return d.validateState()?a.validate():!1},d.validateState=function(){return typeof e.doc!="object"?(d.error({status:20,statusText:"Document_Id Required",error:"document_id_required",message:"No document id.",reason:"no document id"}),!1):!0},d.canBeRetried=function(){return typeof e.option.max_retry=="undefined"||e.option.max_retry===0||e.tried<e.option.max_retry},d.getTried=function(){return e.tried},d.execute=function(a){e.on_going||d.validate(a)&&(e.tried++,e.on_going=!0,a.execute(d))},d.executeOn=function(a){},d.success=function(a){e.on_going=!1,e.success(a),e.end(o())},d.retry=function(a){e.on_going=!1,d.canBeRetried()?e.retry():d.error(a)},d.error=function(a){e.on_going=!1,e.error(a),e.end(p())},d.end=function(){e.end(o())},d.onSuccessDo=function(a){if(a)e.success=a;else return e.success},d.onErrorDo=function(a){if(a)e.error=a;else return e.error},d.onEndDo=function(a){e.end=a},d.onRetryDo=function(a){e.retry=a},d.canBeRestored=function(){return!0},d.clone=function(){return c(d.serialized(),b)},d.cloneOption=function(){var a,b={};for(a in e.option)b[a]=e.option[a];return b},d.cloneDoc=function(){if(e.docid)return e.docid;var a,b={};for(a in e.doc)b[a]=e.doc[a];return b},d)},h=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"allDocs"},d.executeOn=function(a){a.allDocs(d)},d.canBeRestored=function(){return!1},d},j=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"get"},d.validateState=function(){return d.getDocId()?!0:(d.error({status:20,statusText:"Document Id Required",error:"document_id_required",message:"No document id.",reason:"no document id"}),!1)},d.executeOn=function(a){a.get(d)},d.canBeRestored=function(){return!1},d},k=function(a,b){var d=c(a,b);return a=a||{},b=b||{},d.getLabel=function(){return"remove"},d.executeOn=function(a){a.remove(d)},d},l=function(a,b){var d=c(a,b);a=a||{},b=b||{};var e={};d.getLabel=function(){return"put"};var f=d.validateState;return d.validate=function(){return typeof d.getDocInfo("content")!="string"?(d.error({status:21,statusText:"Content Required",error:"content_required",message:"No data to put.",reason:"no data to put"}),!1):f()},d.executeOn=function(a){a.put(d)},d},m=function(a,b){var d=c(a,b);a=a||{},b=b||{};var e={};d.getLabel=function(){return"post"};var f=d.validateState;return d.validate=function(){return typeof d.getDocInfo("content")!="string"?(d.error({status:21,statusText:"Content Required",error:"content_required",message:"No data to put.",reason:"no data to put"}),!1):f()},d.executeOn=function(a){a.put(d)},d},n=function(a,b){var c={};return a=a||{},b=b||{},c.getLabel=function(){return"job status"},c.canStart=function(){},c.canRestart=function(){},c.serialized=function(){return{label:c.getLabel()}},c.isWaitStatus=function(){return!1},c.isDone=function(){return!1},c},o=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"done"},c.canStart=function(){return!1},c.canRestart=function(){return!1},c.isDone=function(){return!0},c},p=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"fail"},c.canStart=function(){return!1},c.canRestart=function(){return!0},c},q=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"initial"},c.canStart=function(){return!0},c.canRestart=function(){return!0},c},r=function(a,b){var c=n(a,b);return a=a||{},b=b||{},c.getLabel=function(){return"on going"},c.canStart=function(){return!1},c.canRestart=function(){return!1},c},s=function(a,b){var c=n(a,b);a=a||{},b=b||{};var d={};return d.job_id_array=a.job_id_array||[],d.threshold=0,c.getLabel=function(){return"wait"},d.refreshJobIdArray=function(){var a=[],b;for(b=0;b<d.job_id_array.length;b+=1)y.jobIdExists(d.job_id_array[b])&&a.push(d.job_id_array[b]);d.job_id_array=a},c.waitForJob=function(a){var b;for(b=0;b<d.job_id_array.length;b+=1)if(d.job_id_array[b]===a.getId())return;d.job_id_array.push(a.getId())},c.dontWaitForJob=function(a){var b,c=[];for(b=0;b<d.job_id_array.length;b+=1)d.job_id_array[b]!==a.getId()&&c.push(d.job_id_array[b]);d.job_id_array=c},c.waitForTime=function(a){d.threshold=Date.now()+a},c.stopWaitForTime=function(){d.threshold=0},c.canStart=function(){return d.refreshJobIdArray(),d.job_id_array.length===0&&Date.now()>=d.threshold},c.canRestart=function(){return c.canStart()},c.serialized=function(){return{label:c.getLabel(),waitfortime:d.threshold,waitforjob:d.job_id_array}},c.isWaitStatus=function(){return!0},c},t=function(a){var b={};a=a||{};var c={};c.id=x.nextId(),c.command=a.command,c.storage=a.storage,c.status=q(),c.date=new Date;if(!c.storage)throw g({job:b,message:"No storage set"});if(!c.command)throw g({job:b,message:"No command set"});return b.getCommand=function(){return c.command},b.getStatus=function(){return c.status},b.getId=function(){return c.id},b.getStorage=function(){return c.storage},b.getDate=function(){return c.date},b.isReady=function(){return c.command.getTried()===0?c.status.canStart():c.status.canRestart()},b.serialized=function(){return{id:c.id,date:c.date.getTime(),status:c.status.serialized(),command:c.command.serialized(),storage:c.storage.serialized()}},b.waitForJob=function(a){c.status.getLabel()!=="wait"&&(c.status=s({})),c.status.waitForJob(a)},b.dontWaitFor=function(a){c.status.getLabel()==="wait"&&c.status.dontWaitForJob(a)},b.waitForTime=function(a){c.status.getLabel()!=="wait"&&(c.status=s({})),c.status.waitForTime(a)},b.stopWaitForTime=function(){c.status.getLabel()==="wait"&&c.status.stopWaitForTime()},b.eliminated=function(){c.command.error({status:10,statusText:"Stopped",error:"stopped",message:"This job has been stopped by another one.",reason:"this job has been stopped by another one"})},b.notAccepted=function(){c.command.onEndDo(function(){c.status=p(),y.terminateJob(b)}),c.command.error({status:11,statusText:"Not Accepted",error:"not_accepted",message:"This job is already running.",reason:"this job is already running"})},b.update=function(a){c.command.error({status:12,statusText:"Replaced",error:"replaced",message:"Job has been replaced by another one.",reason:"job has been replaced by another one"}),c.date=new Date(a.getDate().getTime()),c.command=a.getCommand(),c.status=a.getStatus()},b.execute=function(){if(!b.getCommand().canBeRetried())throw f({job:b,message:"The job was invoked too much time."});if(!b.isReady())throw e({job:b,message:"Can not execute this job."});c.status=r(),c.command.onRetryDo(function(){var a=c.command.getTried();a=a*a*200,a>1e4&&(a=1e4),b.waitForTime(a)}),c.command.onEndDo(function(a){c.status=a,y.terminateJob(b)}),c.command.execute(c.storage)},b},u=function(a,b){var c={};a=a||{},b=b||{};var d=[],e=a.name||"",f=a.announcer||{};return c.add=function(a){d.push(a)},c.remove=function(a){var b,c=[];for(b=0;b<d.length;b+=1)d[b]!==a&&c.push(d[b]);d=c},c.register=function(){f.register(c)},c.unregister=function(){f.unregister(c)},c.trigger=function(a){var b;for(b=0;b<d.length;b++)d[b].apply(null,a)},c},v=function(a,b){var c={};a=a||{},b=b||{};var d={};return d.id=a.id||0,d.interval=400,d.interval_id=null,d.touch=function(){LocalOrCookieStorage.setItem("jio/id/"+d.id,Date.now())},c.setId=function(a){d.id=a},c.setIntervalDelay=function(a){d.interval=a},c.getIntervalDelay=function(){return d.interval},c.start=function(){d.interval_id||(d.touch(),d.interval_id=setInterval(function(){d.touch()},d.interval))},c.stop=function(){d.interval_id!==null&&(clearInterval(d.interval_id),d.interval_id=null)},c}(),w=function(a,b){var c={};a=a||{},b=b||{};var d={};return c.register=function(a){d[a]||(d[a]=u())},c.unregister=function(a){d[a]&&delete d[a]},c.at=function(a){return d[a]},c.on=function(a,b){c.register(a),c.at(a).add(b)},c.trigger=function(a,b){c.at(a).trigger(b)},c}(),x=function(a){var b={};a=a||{};var c=0;return b.nextId=function(){return c=c+1,c},b}(),y=function(a){var b={};a=a||{};var d="jio/job_array",e={};return e.id=a.id,e.interval_id=null,e.interval=200,e.job_array=[],e.getJobArrayName=function(){return d+"/"+e.id},e.getJobArray=function(){return LocalOrCookieStorage.getItem(e.getJobArrayName())||[]},e.copyJobArrayToLocal=function(){var a=[],b;for(b=0;b<e.job_array.length;b+=1)a.push(e.job_array[b].serialized());LocalOrCookieStorage.setItem(e.getJobArrayName(),a)},e.removeJob=function(a){var b,c=[];for(b=0;b<e.job_array.length;b+=1)e.job_array[b]!==a&&c.push(e.job_array[b]);e.job_array=c,e.copyJobArrayToLocal()},b.setId=function(a){e.id=a},b.start=function(){var a;e.interval_id===null&&(e.interval_id=setInterval(function(){e.restoreOldJio();for(a=0;a<e.job_array.length;a+=1)b.execute(e.job_array[a])},e.interval))},b.stop=function(){e.interval_id!==null&&(clearInterval(e.interval_id),e.interval_id=null,e.job_array.length===0&&LocalOrCookieStorage.deleteItem(e.getJobArrayName()))},e.restoreOldJio=function(){var a,b;e.lastrestore=e.lastrestore||0;if(e.lastrestore>Date.now()-2e3)return;b=LocalOrCookieStorage.getItem("jio/id_array")||[];for(a=0;a<b.length;a+=1)e.restoreOldJioId(b[a]);e.lastrestore=Date.now()},e.restoreOldJioId=function(a){var b;b=LocalOrCookieStorage.getItem("jio/id/"+a)||0,(new Date(b)).getTime()<Date.now()-1e4&&(e.restoreOldJobFromJioId(a),e.removeOldJioId(a),e.removeJobArrayFromJioId(a))},e.restoreOldJobFromJioId=function(a){var d,e;e=LocalOrCookieStorage.getItem("jio/job_array/"+a)||[];for(d=0;d<e.length;d+=1){var f=c(e[d].command);f.canBeRestored()&&b.addJob(t({storage:b.storage(e[d].storage),command:f}))}},e.removeOldJioId=function(a){var b,c,d=[];c=LocalOrCookieStorage.getItem("jio/id_array")||[];for(b=0;b<c.length;b+=1)c[b]!==a&&d.push(c[b]);LocalOrCookieStorage.setItem("jio/id_array",d),LocalOrCookieStorage.deleteItem("jio/id/"+a)},e.removeJobArrayFromJioId=function(a){LocalOrCookieStorage.deleteItem("jio/job_array/"+a)},b.execute=function(a){try{a.execute()}catch(b){switch(b.name){case"jobNotReadyException":break;case"tooMuchTriesJobException":break;default:throw b}}e.copyJobArrayToLocal()},b.jobIdExists=function(a){var b;for(b=0;b<e.job_array.length;b+=1)if(e.job_array[b].getId()===a)return!0;return!1},b.terminateJob=function(a){e.removeJob(a)},b.addJob=function(a){var c=b.validateJobAccordingToJobList(e.job_array,a);e.appendJob(a,c)},b.validateJobAccordingToJobList=function(a,b){var c,d=[];for(c=0;c<a.length;c+=1)d.push(z.validateJobAccordingToJob(a[c],b));return d},e.appendJob=function(a,b){var c;if(e.job_array.length!==b.length)throw new RangeError("Array out of bound");for(c=0;c<b.length;c+=1)if(b[c].action==="dont accept")return a.notAccepted();for(c=0;c<b.length;c+=1)switch(b[c].action){case"eliminate":b[c].job.eliminated(),e.removeJob(b[c].job);break;case"update":b[c].job.update(a),e.copyJobArrayToLocal();return;case"wait":a.waitForJob(b[c].job);break;default:}e.job_array.push(a),e.copyJobArrayToLocal()},b.serialized=function(){var a=[],b,c=e.job_array||[];for(b=0;b<c.length;b+=1)a.push(c[b].serialized());return a},b}(),z=function(a){var b={},c={};return c.compare={},c.action={},Object.defineProperty(b,"eliminate",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"eliminate"}}),Object.defineProperty(b,"update",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"update"}}),Object.defineProperty(b,"dontAccept",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"dont accept"}}),Object.defineProperty(b,"wait",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"wait"}}),Object.defineProperty(b,"none",{configurable:!1,enumerable:!1,writable:!1,value:function(){return"none"}}),b.default_action=b.none,b.default_compare=function(a,b){return a.getCommand().getDocId()===b.getCommand().getDocId()&&a.getCommand().getDocInfo("_rev")===b.getCommand().getDocInfo("_rev")&&a.getCommand().getOption("rev")===b.getCommand().getOption("rev")&&JSON.stringify(a.getStorage().serialized())===JSON.stringify(b.getStorage().serialized())},c.getAction=function(a,d){var e,f,g;return e=a.getCommand().getLabel(),f=d.getCommand().getLabel(),g=a.getStatus().getLabel()==="on going"?"on going":"not on going",c.action[e]&&c.action[e][g]&&c.action[e][g][f]?c.action[e][g][f](a,d):b.default_action(a,d)},c.canCompare=function(a,d){var e=a.getCommand().getLabel(),f=d.getCommand().getLabel();return c.compare[e]&&c.compare[f]?c.compare[e][f](a,d):b.default_compare(a,d)},Object.defineProperty(b,"validateJobAccordingToJob",{configurable:!1,enumerable:!1,writable:!1,value:function(a,d){return c.canCompare(a,d)?{action:c.getAction(a,d),job:a}:{action:b.default_action(a,d),job:a}}}),Object.defineProperty(b,"addActionRule",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b,d,e){var f=b?"on going":"not on going";c.action[a]=c.action[a]||{},c.action[a][f]=c.action[a][f]||{},c.action[a][f][d]=e}}),Object.defineProperty(b,"addCompareRule",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b,d){c.compare[a]=c.compare[a]||{},c.compare[a][b]=d}}),b.addActionRule("put",!0,"put",function(a,c){return a.getCommand().getDocInfo("content")===c.getCommand().getDocInfo("content")?b.dontAccept():b.wait()}),b.addActionRule("put",!0,"get",b.wait),b.addActionRule("put",!0,"remove",b.wait),b.addActionRule("put",!1,"put",b.update),b.addActionRule("put",!1,"get",b.wait),b.addActionRule("put",!1,"remove",b.eliminate),b.addActionRule("get",!0,"put",b.wait),b.addActionRule("get",!0,"get",b.dontAccept),b.addActionRule("get",!0,"remove",b.wait),b.addActionRule("get",!1,"put",b.wait),b.addActionRule("get",!1,"get",b.update),b.addActionRule("get",!1,"remove",b.wait),b.addActionRule("remove",!0,"get",b.dontAccept),b.addActionRule("remove",!0,"remove",b.dontAccept),b.addActionRule("remove",!1,"put",b.eliminate),b.addActionRule("remove",!1,"get",b.dontAccept),b.addActionRule("remove",!1,"remove",b.update),b.addActionRule("allDocs",!0,"allDocs",b.dontAccept),b.addActionRule("allDocs",!1,"allDocs",b.update),b}(),A={},B={};a=a||{};var C="jio/id_array";return B.id=null,B.storage_spec=a,B.init=function(){if(B.id===null){var a,b=LocalOrCookieStorage.getItem(C)||[];B.id=1;for(a=0;a<b.length;a+=1)b[a]>=B.id&&(B.id=b[a]+1);b.push(B.id),LocalOrCookieStorage.setItem(C,b),v.setId(B.id),y.setId(B.id)}},Object.defineProperty(A,"storage",{configurable:!1,enumerable:!1,writable:!1,value:function(a,c,e){a=a||{},c=c||{},c.basicStorage=b,c.storage=A.storage;var f=e||a.type||"base";if(f==="base")return b(a,c);if(!i[f])throw d({type:f,message:"Storage does not exists."});return i[f](a,c)}}),y.storage=A.storage,Object.defineProperty(A,"start",{configurable:!1,enumerable:!1,writable:!1,value:function(){B.init(),v.start(),y.start()}}),Object.defineProperty(A,"stop",{configurable:!1,enumerable:!1,writable:!1,value:function(){y.stop()}}),Object.defineProperty(A,"close",{configurable:!1,enumerable:!1,writable:!1,value:function(){v.stop(),y.stop(),B.id=null}}),Object.defineProperty(A,"getId",{configurable:!1,enumerable:!1,writable:!1,value:function(){return B.id}}),Object.defineProperty(A,"getJobRules",{configurable:!1,enumerable:!1,writable:!1,value:function(){return z}}),Object.defineProperty(A,"validateStorageDescription",{configurable:!1,enumerable:!1,writable:!1,value:function(a){return A.storage(a).isValid()}}),Object.defineProperty(A,"getJobArray",{configurable:!1,enumerable:!1,writable:!1,value:function(){return y.serialized()}}),B.getParam=function(a,b){var c={},d=0;return b||(c.doc=a[d],d++),typeof a[d]=="object"?(c.options=a[d],d++):c.options={},c.callback=function(a,b){},c.success=function(a){c.callback(undefined,a)},c.error=function(a){c.callback(a,undefined)},typeof a[d]=="function"&&(typeof a[d+1]=="function"?(c.success=a[d],c.error=a[d+1]):c.callback=a[d]),c},B.addJob=function(a,b){y.addJob(t({storage:A.storage(B.storage_spec),command:a(b)}))},Object.defineProperty(A,"post",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(m,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"put",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(l,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"get",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||3,a.options.metadata_only=a.options.metadata_only!==undefined?a.options.metadata_only:!1,B.addJob(j,{docid:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"remove",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments);a.options.max_retry=a.options.max_retry||0,B.addJob(k,{doc:a.doc,options:a.options,callbacks:{success:a.success,error:a.error}})}}),Object.defineProperty(A,"allDocs",{configurable:!1,enumerable:!1,writable:!1,value:function(){var a=B.getParam(arguments,"no doc");a.options.max_retry=a.options.max_retry||3,a.options.metadata_only=a.options.metadata_only!==undefined?a.options.metadata_only:!0,B.addJob(h,{options:a.options,callbacks:{success:a.success,error:a.error}})}}),A},i={base:function(){}},j=function(a){var b={};return a=a||{},Object.defineProperty(b,"newJio",{configurable:!1,enumerable:!1,writable:!1,value:function(a){var b=a,c=null;return typeof b=="string"&&(b=JSON.parse(b)),b=b||{type:"base"},c=h(a),c.start(),c}}),Object.defineProperty(b,"addStorageType",{configurable:!1,enumerable:!1,writable:!1,value:function(a,b){b=b||function(){return null};if(i[a])throw d({type:a,message:"Already known."});i[a]=b}}),b}();return j}();
\ No newline at end of file \ No newline at end of file
...@@ -24,7 +24,7 @@ var waitStatus = function(spec, my) { ...@@ -24,7 +24,7 @@ var waitStatus = function(spec, my) {
priv.refreshJobIdArray = function() { priv.refreshJobIdArray = function() {
var tmp_job_id_array = [], i; var tmp_job_id_array = [], i;
for (i = 0; i < priv.job_id_array.length; i+= 1) { for (i = 0; i < priv.job_id_array.length; i+= 1) {
if (my.jobManager.jobIdExists(priv.job_id_array[i])) { if (jobManager.jobIdExists(priv.job_id_array[i])) {
tmp_job_id_array.push(priv.job_id_array[i]); tmp_job_id_array.push(priv.job_id_array[i]);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment