fix types, checkUpdate interval

This commit is contained in:
smart_ex 2022-08-05 15:29:51 +10:00
parent ed0a389df2
commit 1b4f25cb9f
2 changed files with 8 additions and 12 deletions

View File

@ -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<typeof withdrawBodySchema> }>(
'/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();
}

View File

@ -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,
},
});