diff --git a/app.ts b/app.ts index 6151bbaff..2a4071599 100644 --- a/app.ts +++ b/app.ts @@ -31,9 +31,9 @@ async function startServer() { enabled: env.NODE_ENV === 'production', ignoreErrors: [/.*error: Provide.*chain.*param/], integrations: [ - new Sentry.Integrations.Apollo(), - new Sentry.Integrations.GraphQL(), - new Sentry.Integrations.Prisma({ client: prisma }), + // new Sentry.Integrations.Apollo(), + // new Sentry.Integrations.GraphQL(), + // new Sentry.Integrations.Prisma({ client: prisma }), new Sentry.Integrations.Express({ app }), new Sentry.Integrations.Http({ tracing: true }), new ProfilingIntegration(), diff --git a/modules/token/lib/token-price.service.ts b/modules/token/lib/token-price.service.ts index 9b51277fb..72c662013 100644 --- a/modules/token/lib/token-price.service.ts +++ b/modules/token/lib/token-price.service.ts @@ -256,28 +256,10 @@ export class TokenPriceService { } public async purgeOldTokenPricesForAllChains(): Promise { - const purgeBeforeTimestamp = moment().startOf('day').subtract(100, 'days').utc().unix(); - const oldPrices = await prisma.prismaTokenPrice.findMany({ - where: { - timestamp: { lt: purgeBeforeTimestamp }, - }, - }); - - // returns all non midnight prices - const tobeDeleted = _.uniq(oldPrices.filter((tokenPrice) => tokenPrice.timestamp % secondsPerDay !== 0)); - - //apparently prisma has a limitation on delete - const chunks = _.chunk(tobeDeleted, 1000); - - for (const chunk of chunks) { - await prisma.prismaTokenPrice.deleteMany({ - where: { - timestamp: { in: chunk.map((tokenPrice) => tokenPrice.timestamp) }, - }, - }); - } + const deleted = + await prisma.$executeRaw`DELETE FROM "PrismaTokenPrice" WHERE DATE(to_timestamp(timestamp)) != to_timestamp(timestamp) AND to_timestamp(timestamp) < CURRENT_DATE - INTERVAL '100 days'`; - return tobeDeleted.length; + return deleted; } private async updateCandleStickData() { diff --git a/worker/worker.ts b/worker/worker.ts index 375a8095a..9ef3cf5bb 100644 --- a/worker/worker.ts +++ b/worker/worker.ts @@ -13,10 +13,10 @@ export async function startWorker() { environment: `multichain-worker-${env.DEPLOYMENT_ENV}`, enabled: env.NODE_ENV === 'production', integrations: [ - new Sentry.Integrations.Apollo(), - new Sentry.Integrations.GraphQL(), - new Sentry.Integrations.Prisma({ client: prisma }), - new Sentry.Integrations.Express({ app }), + // new Sentry.Integrations.Apollo(), + // new Sentry.Integrations.GraphQL(), + // new Sentry.Integrations.Prisma({ client: prisma }), + // new Sentry.Integrations.Express({ app }), new Sentry.Integrations.Http({ tracing: true }), new ProfilingIntegration(), ],