@dhedge/backend-flatcoin-core 0.2.19 → 0.2.21

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)); // 1-second delay
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.sendNotification(messageToSlack);
28
+ await this.notificationService.sendSlackNotification(messageToSlack);
29
29
  }
30
30
  }
31
31
  getGasEstimateErrorName(gasEstimateError) {
@@ -131,7 +131,7 @@ let GraphQueryService = class GraphQueryService {
131
131
  }
132
132
  async getAllOpenPositions() {
133
133
  const allPositions = [];
134
- const first = 1000;
134
+ const first = 999;
135
135
  let skip = 0;
136
136
  // currently thegraph allows to get only 10_000 entities
137
137
  while (skip < 10000) {
@@ -4,6 +4,6 @@ export declare class NotificationService {
4
4
  private readonly slackUri;
5
5
  private readonly telegramUri;
6
6
  constructor(logger: Logger);
7
- sendNotification(message: string): Promise<void>;
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 sendNotification(message) {
33
+ async sendSlackNotification(message, slackUri = this.slackUri) {
32
34
  try {
33
- await axios_1.default.post(this.slackUri, { text: message });
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/backend-flatcoin-core",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "Backend Flatcoin Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",