@dhedge/backend-flatcoin-core 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,7 +62,7 @@ let AppPriceService = class AppPriceService {
|
|
|
62
62
|
catch (err) {
|
|
63
63
|
this.logger.error(`Error querying ${func.name} (retries: ${retries}): ${err.message}`);
|
|
64
64
|
// delay before the next retry
|
|
65
|
-
await new Promise((resolve) => setTimeout(resolve, timeoutMillis));
|
|
65
|
+
await new Promise((resolve) => setTimeout(resolve, timeoutMillis));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
throw new Error(`Max retry attempts reached`);
|
|
@@ -25,7 +25,7 @@ let ErrorHandler = class ErrorHandler {
|
|
|
25
25
|
this.logger.error(messageToSlack, error);
|
|
26
26
|
this.logger.error(error.stack);
|
|
27
27
|
if (process.env.SLACK_NOTIFICATIONS_ENABLED === 'true') {
|
|
28
|
-
await this.notificationService.
|
|
28
|
+
await this.notificationService.sendSlackNotification(messageToSlack);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
getGasEstimateErrorName(gasEstimateError) {
|
|
@@ -4,6 +4,6 @@ export declare class NotificationService {
|
|
|
4
4
|
private readonly slackUri;
|
|
5
5
|
private readonly telegramUri;
|
|
6
6
|
constructor(logger: Logger);
|
|
7
|
-
|
|
7
|
+
sendSlackNotification(message: string, slackUri?: string): Promise<void>;
|
|
8
8
|
sendTelegramNotification(message: string): Promise<void>;
|
|
9
9
|
}
|
|
@@ -27,10 +27,12 @@ let NotificationService = class NotificationService {
|
|
|
27
27
|
if (process.env.TELEGRAM_CHANNEL) {
|
|
28
28
|
this.telegramUri = process.env.TELEGRAM_CHANNEL;
|
|
29
29
|
}
|
|
30
|
+
else
|
|
31
|
+
this.logger.warn('NotificationService -> env property TELEGRAM_CHANNEL is not provided');
|
|
30
32
|
}
|
|
31
|
-
async
|
|
33
|
+
async sendSlackNotification(message, slackUri = this.slackUri) {
|
|
32
34
|
try {
|
|
33
|
-
await axios_1.default.post(
|
|
35
|
+
await axios_1.default.post(slackUri, { text: message });
|
|
34
36
|
}
|
|
35
37
|
catch (error) {
|
|
36
38
|
this.logger.error(`Error sending notification '${message}' to slack channel ${process.env.SLACK_CHANNEL}`, error);
|