From dab10868aacd4c3aadcd48607d94da3b88109683 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Tue, 22 Jul 2025 19:50:20 +0200 Subject: [PATCH] Fix: Re-enable browser cleanup to prevent Chromium resource exhaustion - Re-enabled cleanup logic in enhanced-screenshot API after screenshot/analysis completion - Run cleanup in background to avoid blocking responses - Prevents Chromium processes from spawning indefinitely and consuming resources during automation --- app/api/drift/orders/route.js | 11 ++++++++--- prisma/prisma/dev.db | Bin 782336 -> 798720 bytes 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/api/drift/orders/route.js b/app/api/drift/orders/route.js index bb1730c..063d076 100644 --- a/app/api/drift/orders/route.js +++ b/app/api/drift/orders/route.js @@ -60,12 +60,17 @@ export async function GET() { // Get open orders const orders = userAccount.orders || [] - // Show ALL orders for debugging - not just status 0 + // Filter for active orders (status 0 = open) + const activeOrders = orders.filter(order => + order.status === 0 && !order.baseAssetAmount.isZero() + ) + + // Show ALL orders for debugging - not just active ones const allOrders = orders.filter(order => !order.baseAssetAmount.isZero() // Only filter out empty orders ) - console.log(`📋 Found ${allOrders.length} total orders (${orders.length} order slots)`) + console.log(`📋 Found ${activeOrders.length} active orders, ${allOrders.length} total orders (${orders.length} order slots)`) // Debug: log all order statuses const statusCounts = orders.reduce((acc, order) => { @@ -74,7 +79,7 @@ export async function GET() { }, {}) console.log('📊 Order status breakdown:', statusCounts) - const formattedOrders = allOrders.map(order => { + const formattedOrders = activeOrders.map(order => { const marketIndex = order.marketIndex const symbol = ['SOL', 'BTC', 'ETH', 'APT', 'AVAX', 'BNB', 'MATIC', 'ARB', 'DOGE', 'OP'][marketIndex] || `UNKNOWN_${marketIndex}` diff --git a/prisma/prisma/dev.db b/prisma/prisma/dev.db index 6eaa64028d63952d6634678d40325f45b59a4971..54eb0314af7639ed3ae6934ba939e2591d1351c0 100644 GIT binary patch delta 2234 zcmaJ?eNYtV8Q=GI?{07RI6f2s1zZl0no``4yIuCM0Wy$@7SzUKQX2<2IJm{*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