77import com .iexec .common .replicate .ReplicateStatus ;
88import com .iexec .common .security .Signature ;
99import com .iexec .common .task .TaskDescription ;
10- import com .iexec .common .utils .BytesUtils ;
1110import com .iexec .common .utils .SignatureUtils ;
1211import com .iexec .worker .chain .ContributionService ;
1312import com .iexec .worker .chain .IexecHubService ;
1413import com .iexec .worker .chain .RevealService ;
1514import com .iexec .worker .chain .Web3jService ;
15+ import com .iexec .worker .config .PublicConfigurationService ;
1616import com .iexec .worker .config .WorkerConfigurationService ;
1717import com .iexec .worker .dataset .DatasetService ;
1818import com .iexec .worker .docker .DockerComputationService ;
@@ -52,12 +52,14 @@ public class TaskExecutorService {
5252 private IexecHubService iexecHubService ;
5353 private SmsService smsService ;
5454 private Web3jService web3jService ;
55+ private PublicConfigurationService publicConfigurationService ;
5556
5657 // internal variables
5758 private int maxNbExecutions ;
5859 private ThreadPoolExecutor executor ;
5960 private String corePublicAddress ;
6061
62+ //TODO make this fat constructor lose weight
6163 public TaskExecutorService (DatasetService datasetService ,
6264 DockerComputationService dockerComputationService ,
6365 ResultService resultService ,
@@ -67,7 +69,8 @@ public TaskExecutorService(DatasetService datasetService,
6769 WorkerConfigurationService workerConfigurationService ,
6870 IexecHubService iexecHubService ,
6971 SmsService smsService ,
70- Web3jService web3jService ) {
72+ Web3jService web3jService ,
73+ PublicConfigurationService publicConfigurationService ) {
7174 this .datasetService = datasetService ;
7275 this .dockerComputationService = dockerComputationService ;
7376 this .resultService = resultService ;
@@ -78,14 +81,15 @@ public TaskExecutorService(DatasetService datasetService,
7881 this .iexecHubService = iexecHubService ;
7982 this .smsService = smsService ;
8083 this .web3jService = web3jService ;
84+ this .publicConfigurationService = publicConfigurationService ;
8185
8286 maxNbExecutions = Runtime .getRuntime ().availableProcessors () - 1 ;
8387 executor = (ThreadPoolExecutor ) Executors .newFixedThreadPool (maxNbExecutions );
8488 }
8589
8690 @ PostConstruct
8791 public void initIt () {
88- corePublicAddress = customFeignClient . getPublicConfiguration () .getSchedulerPublicAddress ();
92+ corePublicAddress = publicConfigurationService .getSchedulerPublicAddress ();
8993 }
9094
9195 public boolean canAcceptMoreReplicates () {
@@ -145,7 +149,7 @@ private String compute(ContributionAuthorization contributionAuth) {
145149
146150 Optional <TaskDescription > taskDescriptionFromChain = iexecHubService .getTaskDescriptionFromChain (chainTaskId );
147151
148- if (!taskDescriptionFromChain .isPresent ()){
152+ if (!taskDescriptionFromChain .isPresent ()) {
149153 stdout = "AvailableReplicateModel not found" ;
150154 log .error (stdout + " [chainTaskId:{}]" , chainTaskId );
151155 return stdout ;
@@ -276,7 +280,7 @@ public void contribute(ContributionAuthorization contribAuth) {
276280
277281 if (oChainReceipt .get ().getBlockNumber () == 0 ) {
278282 log .warn ("The blocknumber of the receipt is equal to 0, the CONTRIBUTED status will not be " +
279- "sent to the core [chainTaskId:{}]" , chainTaskId );
283+ "sent to the core [chainTaskId:{}]" , chainTaskId );
280284 return ;
281285 }
282286
0 commit comments