diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36dcda3..e5f2d50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 16 - - run: yarn install --skip-integrity-check + - run: yarn install --network-concurrency=2 # - run: yarn test - run: yarn lint - name: Telegram Failure Notification diff --git a/Dockerfile b/Dockerfile index 4562779..095ce34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /usr/app COPY yarn.lock . COPY package.json . RUN apk update && apk add --no-cache g++ make python3 git openssh && rm -rf /var/cache/apk/* -RUN yarn install +RUN yarn install --network-concurrency 2 COPY . ./ RUN yarn build @@ -23,5 +23,6 @@ COPY --from=dev /usr/app/build /app COPY --from=dev /usr/app/package.json /app/ COPY --from=dev /usr/app/yarn.lock /app/ -RUN yarn install && yarn cache clean -f +RUN yarn install --network-concurrency 2 && yarn cache clean -f +ENTRYPOINT ["yarn"] diff --git a/package.json b/package.json index 734d65a..421b958 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "5.0.0", "description": "Relayer for Tornado.cash privacy solution. https://tornado.cash", "scripts": { - "server": "node app/index.js", - "txWorker": "node txWorker.js", - "healthWorker": "node healthWorker.js", + "server": "node src/app/index.js", + "txWorker": "node src/txWorker.js", + "healthWorker": "node src/healthWorker.js", "dev:server": "nodemon --watch './src/**/*.ts' --exec ts-node src/app/index.ts", "dev:healthWorker": "nodemon --watch './src/**/*.ts' --exec ts-node src/healthWorker.ts", "dev:txWorker": "nodemon --watch './src/**/*.ts' --exec ts-node src/txWorker.ts", diff --git a/src/config.ts b/src/config.ts index 1377f71..ab0379c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,9 +1,11 @@ import { RelayerJobType } from './types'; import tornConfig, { availableIds } from 'torn-token'; +import { config } from 'dotenv'; +import { version } from '../package.json'; -require('dotenv').config(); +config(); const isProduction = process.env.NODE_ENV === 'production'; -export const relayerVersion = require(`${isProduction ? '.' : '..'}/package.json`).version; +export const relayerVersion = version; export const netId = Number(process.env.NET_ID || 1); export const redisUrl = process.env.REDIS_URL || 'redis://127.0.0.1:6379'; export const rpcUrl = process.env.HTTP_RPC_URL; diff --git a/src/services/health.service.ts b/src/services/health.service.ts index 693d516..55eea33 100644 --- a/src/services/health.service.ts +++ b/src/services/health.service.ts @@ -36,7 +36,10 @@ export class HealthService { private async _getStatus() { const status = await this.store.client.hgetall('health:status'); - return status || { health: 'false', error: 'Service is not running' }; + if (Object.keys(status).length === 0) { + return { health: 'false', error: 'Service is not running' }; + } + return status; } private static _parseSet(log, to = 'array', keys = ['message', 'score']) { @@ -64,7 +67,7 @@ export class HealthService { async getStatus() { const { errorsLog, errorsCode } = await this._getErrors(); - if (errorsCode['NETWORK_ERROR'] > 6) { + if (errorsCode['NETWORK_ERROR'] > 10) { await this.setStatus({ status: false, error: 'Network error' }); } const heathStatus = await this._getStatus();