Skip to content

Commit f2f57b6

Browse files
committed
Highlight messages when out of gas
1 parent e4ebcbe commit f2f57b6

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/main/java/com/iexec/worker/Application.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,16 @@ public void run(String... args) {
8989
if (!publicConfiguration.getRequiredWorkerVersion().isEmpty() &&
9090
!versionService.getVersion().equals(publicConfiguration.getRequiredWorkerVersion())) {
9191

92-
String message = String.format("Bad version! please upgrade your iexec-worker [current:%s, required:%s]",
92+
String badVersion = String.format("Bad version! please upgrade your iexec-worker [current:%s, required:%s]",
9393
versionService.getVersion(), publicConfiguration.getRequiredWorkerVersion());
9494

95-
LoggingUtils.printHighlightedMessage(message);
95+
LoggingUtils.printHighlightedMessage(badVersion);
9696
System.exit(0);
9797
}
9898

9999
if (!iexecHubService.hasEnoughGas()) {
100-
log.error("No enough gas, please refill your wallet!");
100+
String noEnoughGas = String.format("No enough gas! please refill your wallet [walletAddress:%s]", workerAddress);
101+
LoggingUtils.printHighlightedMessage(noEnoughGas);
101102
System.exit(0);
102103
}
103104

src/main/java/com/iexec/worker/executor/TaskExecutorService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.iexec.worker.feign.CustomFeignClient;
1919
import com.iexec.worker.result.ResultService;
2020
import com.iexec.worker.sms.SmsService;
21+
import com.iexec.worker.utils.LoggingUtils;
2122

2223
import lombok.extern.slf4j.Slf4j;
2324

@@ -216,6 +217,9 @@ public void contribute(ContributionAuthorization contribAuth) {
216217

217218
if (!contributionService.hasEnoughGas()) {
218219
customFeignClient.updateReplicateStatus(chainTaskId, OUT_OF_GAS);
220+
String noEnoughGas = String.format("Out of gas! please refill your wallet [walletAddress:%s]",
221+
contribAuth.getWorkerWallet());
222+
LoggingUtils.printHighlightedMessage(noEnoughGas);
219223
System.exit(0);
220224
}
221225

@@ -250,6 +254,10 @@ public void reveal(String chainTaskId) {
250254

251255
if (!revealService.hasEnoughGas()) {
252256
customFeignClient.updateReplicateStatus(chainTaskId, OUT_OF_GAS);
257+
customFeignClient.updateReplicateStatus(chainTaskId, OUT_OF_GAS);
258+
String noEnoughGas = String.format("Out of gas! please refill your wallet [walletAddress:%s]",
259+
workerConfigurationService.getWorkerWalletAddress());
260+
LoggingUtils.printHighlightedMessage(noEnoughGas);
253261
System.exit(0);
254262
}
255263

0 commit comments

Comments
 (0)