From 3cf1cfcde7c5c71044e28fa1468ceb10c3d14314 Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:26:51 +0100 Subject: [PATCH] fix status updates for filtered pools --- modules/pool/lib/pool-on-chain-data.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/pool/lib/pool-on-chain-data.service.ts b/modules/pool/lib/pool-on-chain-data.service.ts index 0f54decb7..44346b3e9 100644 --- a/modules/pool/lib/pool-on-chain-data.service.ts +++ b/modules/pool/lib/pool-on-chain-data.service.ts @@ -57,8 +57,11 @@ export class PoolOnChainDataService { const operations = []; for (const pool of filteredPools) { + if (!state[pool.id]) continue; // Some pool types are filtered out in the state fetching function + const { isPaused, isInRecoveryMode } = state[pool.id]; - if (pool.dynamicData) { + const data = pool.dynamicData; + if (data && data.isPaused !== isPaused && data.isInRecoveryMode !== isInRecoveryMode) { operations.push( prisma.prismaPoolDynamicData.update({ where: { id_chain: { id: pool.id, chain: this.options.chain } }, @@ -66,7 +69,7 @@ export class PoolOnChainDataService { isPaused, isInRecoveryMode, }, - }), + }) ); } }