fix: redis url

This commit is contained in:
Danil Kovtonyuk 2021-10-27 23:17:35 +10:00 committed by 0xZick
parent fa6ce3ca65
commit 2259d7d15f
5 changed files with 17 additions and 9 deletions

@ -5,6 +5,11 @@ LETSENCRYPT_HOST=
# server settings # server settings
PORT=8000 PORT=8000
# for production
REDIS_URL=redis://redis/0
# for development
# REDIS_URL=localhost
CHAIN_ID=100 CHAIN_ID=100
REWARD_ADDRESS= REWARD_ADDRESS=

@ -11,8 +11,8 @@
"build": "nest build", "build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start", "start": "nest start",
"start:dev": "NODE_ENV=development nest start --watch", "start:dev": "nest start --watch",
"start:debug": "NODE_ENV=development nest start --debug --watch", "start:debug": "nest start --debug --watch",
"start:prod": "yarn prebuild; yarn build; node dist/src/main", "start:prod": "yarn prebuild; yarn build; node dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest", "test": "jest",

@ -1,11 +1,7 @@
import { registerAs } from '@nestjs/config'; import { registerAs } from '@nestjs/config';
export default registerAs('bull', () => ({ export default registerAs('bull', () => ({
name: 'transaction', redis: process.env.REDIS_URL || 'localhost',
redis: {
host: process.env.NODE_ENV === 'development' ? 'localhost' : 'redis',
port: 6379,
},
settings: { settings: {
lockDuration: 300000, lockDuration: 300000,
lockRenewTime: 30000, lockRenewTime: 30000,

@ -1,5 +1,5 @@
import { BullModule } from '@nestjs/bull';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bull';
import { GasPriceService, ProviderService, OffchainPriceService } from '@/services'; import { GasPriceService, ProviderService, OffchainPriceService } from '@/services';
@ -8,7 +8,12 @@ import { TransactionProcessor } from './transaction.processor';
import bullConfig from '@/config/bull.config'; import bullConfig from '@/config/bull.config';
@Module({ @Module({
imports: [BullModule.registerQueue(bullConfig())], imports: [
BullModule.registerQueueAsync({
name: 'transaction',
useFactory: bullConfig,
}),
],
providers: [GasPriceService, ProviderService, TransactionProcessor, OffchainPriceService], providers: [GasPriceService, ProviderService, TransactionProcessor, OffchainPriceService],
exports: [BullModule], exports: [BullModule],
}) })

@ -157,6 +157,8 @@ export class TransactionProcessor extends BaseProcessor<Transaction> {
throw new Error(`Revert by smart contract: ${error}`); throw new Error(`Revert by smart contract: ${error}`);
} }
console.log('handleError:', message);
throw new Error('Relayer did not send your transaction. Please choose a different relayer.'); throw new Error('Relayer did not send your transaction. Please choose a different relayer.');
} }
} }