From 1b4f25cb9fecf588fc8d4e917b164677ab70e9cf Mon Sep 17 00:00:00 2001 From: smart_ex Date: Fri, 5 Aug 2022 15:29:51 +1000 Subject: [PATCH] fix types, checkUpdate interval --- src/app/routes.ts | 18 +++++++----------- src/queue/index.ts | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app/routes.ts b/src/app/routes.ts index bbe558a..dd28997 100644 --- a/src/app/routes.ts +++ b/src/app/routes.ts @@ -1,9 +1,9 @@ import { FastifyInstance } from 'fastify'; -import { jobsSchema, statusSchema, withdrawBodySchema, withdrawSchema } from './schema'; -import { FromSchema } from 'json-schema-to-ts'; +import { jobsSchema, statusSchema, withdrawSchema } from './schema'; import { relayerVersion, rewardAccount, tornadoServiceFee } from '../config'; import { configService, getHealthService, getJobService, getPriceService } from '../services'; import { RelayerJobType } from '../types'; +import { WithdrawalData } from '../services/tx.service'; export function mainHandler(server: FastifyInstance, options, next) { const jobService = getJobService(); @@ -46,14 +46,10 @@ export function relayerHandler(server: FastifyInstance, options, next) { res.send({ ...job.data, failedReason: job.failedReason }); }); - server.post<{ Body: FromSchema }>( - '/tornadoWithdraw', - { schema: withdrawSchema }, - async (req, res) => { - console.log(req.body); - const id = await jobService.postJob(RelayerJobType.TORNADO_WITHDRAW, req.body); - res.send({ id }); - }, - ); + server.post<{ Body: WithdrawalData }>('/tornadoWithdraw', { schema: withdrawSchema }, async (req, res) => { + server.log.info(`Withdrawal request: ${JSON.stringify(req.body)}`); + const id = await jobService.postJob(RelayerJobType.TORNADO_WITHDRAW, req.body); + res.send({ id }); + }); next(); } diff --git a/src/queue/index.ts b/src/queue/index.ts index 8bec150..1a23d2c 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -174,7 +174,7 @@ export class HealthQueueHelper { }); await this.queue.add('checkUpdate', null, { repeat: { - every: this.interval * 2, + every: this.interval * 2 * 60, // once per hour immediately: true, }, });