mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
fix pub/sub
This commit is contained in:
parent
5aebdab767
commit
8c027dbfcf
@ -11,21 +11,21 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
depends_on: [ redis ]
|
depends_on: [redis]
|
||||||
|
|
||||||
txWorker:
|
txWorker:
|
||||||
image: tornadocash/relayer:v5.0.0
|
image: tornadocash/relayer:v5.0.0
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: 'node txWorker.js'
|
command: 'node txWorker.js'
|
||||||
env_file: .env
|
env_file: .env
|
||||||
depends_on: [ redis ]
|
depends_on: [redis]
|
||||||
|
|
||||||
healthWorker:
|
healthWorker:
|
||||||
image: tornadocash/relayer:v5.0.0
|
image: tornadocash/relayer:v5.0.0
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: 'node healthWorker.js'
|
command: 'node healthWorker.js'
|
||||||
env_file: .env
|
env_file: .env
|
||||||
depends_on: [ redis ]
|
depends_on: [redis]
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
|
@ -91,7 +91,8 @@ export class HealthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async pushAlert(alert: Alert) {
|
async pushAlert(alert: Alert) {
|
||||||
await this.store.publisher.publish('user-notify', JSON.stringify(alert));
|
const channel = `${this.config.netId}/user-notify`;
|
||||||
|
await this.store.publisher.publish(channel, JSON.stringify(alert));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _checkBalance(value, currency: 'MAIN' | 'TORN') {
|
private async _checkBalance(value, currency: 'MAIN' | 'TORN') {
|
||||||
|
@ -2,6 +2,7 @@ import { Telegram } from 'telegraf';
|
|||||||
import { autoInjectable, container } from 'tsyringe';
|
import { autoInjectable, container } from 'tsyringe';
|
||||||
import { RedisStore } from '../modules/redis';
|
import { RedisStore } from '../modules/redis';
|
||||||
import { ExtraReplyMessage } from 'telegraf/typings/telegram-types';
|
import { ExtraReplyMessage } from 'telegraf/typings/telegram-types';
|
||||||
|
import { netId } from '../config';
|
||||||
|
|
||||||
export type Levels = keyof typeof AlertLevel;
|
export type Levels = keyof typeof AlertLevel;
|
||||||
|
|
||||||
@ -60,7 +61,8 @@ export class NotifierService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async subscribe() {
|
async subscribe() {
|
||||||
this.store.subscriber.subscribe('user-notify');
|
const channel = `${netId}/user-notify`;
|
||||||
|
this.store.subscriber.subscribe(channel);
|
||||||
this.store.subscriber.on('message', async (channel, message) => {
|
this.store.subscriber.on('message', async (channel, message) => {
|
||||||
await this.processAlert(<string>message);
|
await this.processAlert(<string>message);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user