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

View File

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

View File

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

View File

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

View File

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

View File

@ -157,6 +157,8 @@ export class TransactionProcessor extends BaseProcessor<Transaction> {
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.');
}
}