From 45180430d20cb77278d452be21963a9e53c5e557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A1rdenas?= Date: Wed, 28 Jun 2023 13:39:57 -0600 Subject: [PATCH] fix: check for prod correctly when refreshing materialized views (#112) --- src/pg/pg-store.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pg/pg-store.ts b/src/pg/pg-store.ts index 6fd4bd23..5ca11369 100644 --- a/src/pg/pg-store.ts +++ b/src/pg/pg-store.ts @@ -1,11 +1,7 @@ import { Order, OrderBy } from '../api/schemas'; -import { normalizedHexString, parseSatPoint } from '../api/util/helpers'; +import { isProdEnv, normalizedHexString, parseSatPoint } from '../api/util/helpers'; import { OrdinalSatoshi, SatoshiRarity } from '../api/util/ordinal-satoshi'; -import { - ChainhookPayload, - CursedInscriptionRevealed, - InscriptionRevealed, -} from '../chainhook/schemas'; +import { ChainhookPayload } from '../chainhook/schemas'; import { ENV } from '../env'; import { logger } from '../logger'; import { getIndexResultCountType, inscriptionContentToJson } from './helpers'; @@ -531,9 +527,8 @@ export class PgStore extends BasePgStore { } async refreshMaterializedView(viewName: string) { - const isProd = process.env.NODE_ENV === 'production'; await this.sql`REFRESH MATERIALIZED VIEW ${ - isProd ? this.sql`CONCURRENTLY` : this.sql`` + isProdEnv ? this.sql`CONCURRENTLY` : this.sql`` } ${this.sql(viewName)}`; }