File tree Expand file tree Collapse file tree
src/interconnected_node/contribution/mapreduce/jobs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,17 +138,22 @@ export default class MapReduceMasterJob implements Job {
138138 console . log ( 'RECRUITMENT COMPLETED' ) ;
139139 }
140140 return new Promise < void > ( ( resolve ) => {
141- masterP2PConnection . sendMessage (
142- JSON . stringify ( {
143- channel : 'START_JOB' ,
144- payload : {
145- name : 'REDUCE_WORKER' ,
146- params : {
147- reduceFunction : this . reduceFunction ,
148- } ,
149- } ,
150- } )
151- ) ;
141+ const waitingForP2PConnectionToFinalize = setInterval ( ( ) => {
142+ if ( masterP2PConnection . remoteDescription !== undefined ) {
143+ clearInterval ( waitingForP2PConnectionToFinalize ) ;
144+ masterP2PConnection . sendMessage (
145+ JSON . stringify ( {
146+ channel : 'START_JOB' ,
147+ payload : {
148+ name : 'REDUCE_WORKER' ,
149+ params : {
150+ reduceFunction : this . reduceFunction ,
151+ } ,
152+ } ,
153+ } )
154+ ) ;
155+ }
156+ } , 100 ) ;
152157 resolve ( ) ;
153158 } ) ;
154159 }
You can’t perform that action at this time.
0 commit comments