Browse Source

fix: resolve loading state reset and advisory lock client close errors

Remove silent option guard so vendor loading state always resets when
the request completes, preventing stale loading indicators. Wrap
advisory lock client.end() in try-catch to avoid unhandled errors
during connection teardown.
ding113 3 weeks ago
parent
commit
1cee0a9135

+ 1 - 1
src/app/[locale]/dashboard/availability/_components/endpoint/endpoint-tab.tsx

@@ -130,7 +130,7 @@ export function EndpointTab() {
       console.error("Failed to fetch vendors:", error);
       return null;
     } finally {
-      if (!options?.silent && requestId === vendorsRequestIdRef.current) {
+      if (requestId === vendorsRequestIdRef.current) {
         setLoadingVendors(false);
       }
     }

+ 8 - 1
src/lib/migrate.ts

@@ -48,7 +48,14 @@ export async function withAdvisoryLock<T>(
       }
     }
 
-    await client.end();
+    try {
+      await client.end();
+    } catch (endError) {
+      logger.error("Failed to close advisory lock client", {
+        lockName,
+        error: endError instanceof Error ? endError.message : String(endError),
+      });
+    }
   }
 }