@@ -34,29 +34,18 @@ qx.Class.define("osparc.store.PollTasks", {
3434 . then ( tasksData => {
3535 tasksData . forEach ( taskData => {
3636 const interval = 1000 ;
37- this . addTask ( taskData , interval ) ;
37+ this . __addTask ( taskData , interval ) ;
3838 } ) ;
3939 } )
4040 . catch ( err => console . error ( err ) ) ;
4141 } ,
4242
43- addTask : function ( taskData , interval = 1000 ) {
44- const tasks = this . getTasks ( ) ;
45- const index = tasks . findIndex ( t => t . getTaskId ( ) === taskData [ "task_id" ] ) ;
46- if ( index === - 1 ) {
47- const task = new osparc . data . PollTask ( taskData , interval ) ;
48- tasks . push ( task ) ;
49- return task ;
50- }
51- return null ;
52- } ,
53-
5443 createPollingTask : function ( fetchPromise , interval ) {
5544 return new Promise ( ( resolve , reject ) => {
5645 fetchPromise
5746 . then ( taskData => {
5847 if ( "status_href" in taskData ) {
59- const task = this . addTask ( taskData , interval ) ;
48+ const task = this . __addTask ( taskData , interval ) ;
6049 resolve ( task ) ;
6150 } else {
6251 throw Error ( "Status missing" ) ;
@@ -66,6 +55,17 @@ qx.Class.define("osparc.store.PollTasks", {
6655 } ) ;
6756 } ,
6857
58+ __addTask : function ( taskData , interval = 1000 ) {
59+ const tasks = this . getTasks ( ) ;
60+ const index = tasks . findIndex ( t => t . getTaskId ( ) === taskData [ "task_id" ] ) ;
61+ if ( index === - 1 ) {
62+ const task = new osparc . data . PollTask ( taskData , interval ) ;
63+ tasks . push ( task ) ;
64+ return task ;
65+ }
66+ return null ;
67+ } ,
68+
6969 getDuplicateStudyTasks : function ( ) {
7070 return this . getTasks ( ) . filter ( task => task . getTaskId ( ) . includes ( "from_study" ) && ! task . getTaskId ( ) . includes ( "as_template" ) ) ;
7171 } ,
0 commit comments