fix: implements factory produced di values dispose#2150
Conversation
WalkthroughRemoves explicit disposal and connection-readiness helpers for signing clients and the startServer beforeEnd hook; adds a singleton DisposableRegistry to register and concurrently dispose resources created by factory providers; integrates registry into DB/postgres APP_INITIALIZER factories; updates a test env RPC endpoint. Changes
Sequence Diagram(s)sequenceDiagram
participant Bootstrap
participant App as App Startup
participant Registry as DisposableRegistry
participant Factory as Provider Factory
participant Resource as Resource (DB / client)
participant Shutdown
Bootstrap->>App: boot
App->>Registry: registerFromFactory(factory)
Registry->>Factory: invoke wrapped factory(container)
Factory->>Resource: create/connect
Resource-->>Factory: returns { ON_APP_START, dispose }
Factory-->>Registry: factory result
Registry->>Registry: register dispose callback
Note over Bootstrap,Shutdown: app runs
Shutdown->>Registry: dispose()
Registry->>Resource: call dispose() (concurrent)
Resource-->>Registry: disposed / error
Registry-->>Shutdown: all disposes settled (or AggregateError)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (13)
💤 Files with no reviewable changes (6)
🚧 Files skipped from review as they are similar to previous changes (4)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Files:
**/*.{js,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-08-21T04:03:23.490ZApplied to files:
📚 Learning: 2025-08-21T04:03:23.490ZApplied to files:
🧬 Code graph analysis (1)apps/api/src/core/providers/postgres.provider.ts (2)
🪛 dotenv-linter (4.0.0)apps/api/env/.env.functional.test[warning] 5-5: [UnorderedKey] The RPC_NODE_ENDPOINT key should go before the UAKT_TOP_UP_MASTER_WALLET_MNEMONIC key (UnorderedKey) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
Comment |
4b4bb8b to
2c0efaa
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/api/env/.env.functional.test(1 hunks)apps/api/src/background-jobs-app.ts(1 hunks)apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts(0 hunks)apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts(0 hunks)apps/api/src/billing/providers/signing-client.provider.ts(0 hunks)apps/api/src/billing/services/dedupe-signing-client/dedupe-signing-client.service.ts(0 hunks)apps/api/src/console.ts(0 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts(1 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.ts(1 hunks)apps/api/src/core/providers/postgres.provider.ts(2 hunks)apps/api/src/core/services/start-server/start-server.ts(0 hunks)apps/api/src/db/dbConnection.ts(2 hunks)apps/api/src/rest-app.ts(1 hunks)
💤 Files with no reviewable changes (6)
- apps/api/src/billing/providers/signing-client.provider.ts
- apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts
- apps/api/src/core/services/start-server/start-server.ts
- apps/api/src/console.ts
- apps/api/src/billing/services/dedupe-signing-client/dedupe-signing-client.service.ts
- apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts
- apps/api/src/background-jobs-app.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/api/src/core/lib/disposable-registry/disposable-registry.tsapps/api/src/rest-app.tsapps/api/src/core/providers/postgres.provider.tsapps/api/src/db/dbConnection.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/api/src/core/lib/disposable-registry/disposable-registry.tsapps/api/src/rest-app.tsapps/api/src/core/providers/postgres.provider.tsapps/api/src/db/dbConnection.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: In the Akash Network console project, services like JobQueueService implement dispose() methods for resource cleanup, and the tsyringe container has been extended with a dispose() method that iterates over all registered instances and calls their dispose() methods, enabling proper shutdown orchestration.
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: In the Akash Network console project, services like JobQueueService implement dispose() methods for resource cleanup, and the tsyringe container has been extended with a dispose() method that iterates over all registered instances and calls their dispose() methods, enabling proper shutdown orchestration.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
🧬 Code graph analysis (3)
apps/api/src/rest-app.ts (1)
apps/api/src/core/providers/postgres.provider.ts (1)
migratePG(27-27)
apps/api/src/core/providers/postgres.provider.ts (1)
apps/api/src/core/providers/app-initializer.ts (2)
ON_APP_START(4-4)AppInitializer(6-8)
apps/api/src/db/dbConnection.ts (2)
apps/api/src/core/providers/postgres.provider.ts (1)
closeConnections(57-57)apps/api/src/core/providers/app-initializer.ts (1)
AppInitializer(6-8)
🪛 dotenv-linter (4.0.0)
apps/api/env/.env.functional.test
[warning] 5-5: [UnorderedKey] The RPC_NODE_ENDPOINT key should go before the UAKT_TOP_UP_MASTER_WALLET_MNEMONIC key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
🔇 Additional comments (7)
apps/api/env/.env.functional.test (1)
5-5: Verify the new RPC endpoint is accessible and correct.The RPC endpoint has been updated to
https://rpc.sandbox.akt.dev/rpc. Ensure this endpoint is:
- Active and responding to requests.
- Appropriate for functional testing with the sandbox network.
Also note that other endpoints in the file (lines 22–23) still reference the
sandbox-2.aksh.pwdomain. If this is intentional (e.g., different services with different endpoints), no action is needed. If all endpoints should be updated together, please sync them.apps/api/src/db/dbConnection.ts (1)
56-66: LGTM! Proper integration with DisposableRegistry.The APP_INITIALIZER registration correctly wraps the factory with
DisposableRegistry.registerFromFactory, ensuring that database connections will be properly disposed when the registry is disposed.apps/api/src/core/providers/postgres.provider.ts (1)
59-67: LGTM! Proper integration with DisposableRegistry.The APP_INITIALIZER registration correctly wraps the factory with
DisposableRegistry.registerFromFactory, ensuring that postgres client connections will be properly disposed when the registry is disposed.apps/api/src/core/lib/disposable-registry/disposable-registry.ts (3)
11-25: LGTM! Proper singleton pattern with convenient static method.The class is correctly decorated as a singleton and the static method properly delegates to the container-resolved instance, providing a convenient API for wrapping factories.
39-49: LGTM! Correct factory wrapping implementation.The instance method correctly wraps the factory, detects disposable values, and registers their disposal while passing through the original value unchanged.
70-72: LGTM! Robust type guard implementation.The
isDisposabletype guard correctly checks all necessary conditions and properly narrows the type using a type predicate.apps/api/src/rest-app.ts (1)
200-204: ****The removal of
beforeEndfrom thestartServercall is not problematic. The current implementation ofstartServeralready handles resource disposal through its internal shutdown mechanism. It registers process event handlers (SIGTERM, SIGINT, exit) and callscontainer.dispose()on shutdown, which properly disposes theDisposableRegistrysingleton. ThebeforeEndoption does not exist in the currentstartServerAPI, so there is no concern about missing cleanup.Likely an incorrect or invalid review comment.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2150 +/- ##
==========================================
- Coverage 46.79% 46.48% -0.31%
==========================================
Files 1014 1005 -9
Lines 28721 28385 -336
Branches 7434 7397 -37
==========================================
- Hits 13439 13195 -244
+ Misses 14107 14024 -83
+ Partials 1175 1166 -9
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
6d7ecbd to
8bd14e0
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/api/env/.env.functional.test (1)
1-42: Optional: Consider alphabetically ordering environment keys.The static analysis tool flagged that
RPC_NODE_ENDPOINTshould be ordered beforeUAKT_TOP_UP_MASTER_WALLET_MNEMONIC(alphabetically). While this is a minor issue, reordering keys can improve consistency and maintainability. This is optional and can be deferred if not part of your project's style guidelines.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
apps/api/env/.env.functional.test(1 hunks)apps/api/src/background-jobs-app.ts(1 hunks)apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts(0 hunks)apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts(0 hunks)apps/api/src/billing/providers/signing-client.provider.ts(0 hunks)apps/api/src/console.ts(0 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts(1 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.ts(1 hunks)apps/api/src/core/providers/postgres.provider.ts(2 hunks)apps/api/src/core/services/start-server/start-server.ts(0 hunks)apps/api/src/db/dbConnection.ts(2 hunks)apps/api/src/rest-app.ts(1 hunks)
💤 Files with no reviewable changes (5)
- apps/api/src/billing/providers/signing-client.provider.ts
- apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts
- apps/api/src/console.ts
- apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts
- apps/api/src/core/services/start-server/start-server.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts
- apps/api/src/background-jobs-app.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/api/src/db/dbConnection.tsapps/api/src/core/providers/postgres.provider.tsapps/api/src/core/lib/disposable-registry/disposable-registry.tsapps/api/src/rest-app.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/api/src/db/dbConnection.tsapps/api/src/core/providers/postgres.provider.tsapps/api/src/core/lib/disposable-registry/disposable-registry.tsapps/api/src/rest-app.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
📚 Learning: 2025-08-20T11:41:36.039Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1740
File: apps/log-collector/src/services/pod-logs-collector/pod-logs-collector.service.ts:127-145
Timestamp: 2025-08-20T11:41:36.039Z
Learning: In log collection services like PodLogsCollectorService, write promises for continuous log streaming are intentionally long-running and expected to remain pending during normal operation. Using Promise.all to wait for both write and streaming promises ensures proper error propagation from either stream, which is the correct pattern for long-running log collection processes.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: In the Akash Network console project, services like JobQueueService implement dispose() methods for resource cleanup, and the tsyringe container has been extended with a dispose() method that iterates over all registered instances and calls their dispose() methods, enabling proper shutdown orchestration.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
🧬 Code graph analysis (3)
apps/api/src/db/dbConnection.ts (3)
apps/api/src/rest-app.ts (2)
ON_APP_START(192-194)connectUsingSequelize(198-198)apps/api/src/app/providers/jobs.provider.ts (1)
ON_APP_START(13-23)apps/api/src/core/providers/app-initializer.ts (1)
AppInitializer(6-8)
apps/api/src/core/providers/postgres.provider.ts (2)
apps/api/src/db/dbConnection.ts (2)
ON_APP_START(60-62)closeConnections(55-55)apps/api/src/core/providers/app-initializer.ts (2)
ON_APP_START(4-4)AppInitializer(6-8)
apps/api/src/rest-app.ts (1)
apps/api/src/core/providers/postgres.provider.ts (1)
migratePG(27-27)
🪛 dotenv-linter (4.0.0)
apps/api/env/.env.functional.test
[warning] 5-5: [UnorderedKey] The RPC_NODE_ENDPOINT key should go before the UAKT_TOP_UP_MASTER_WALLET_MNEMONIC key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
🔇 Additional comments (8)
apps/api/env/.env.functional.test (1)
5-5: Endpoint URL update is correct.The RPC endpoint change from
sandbox-2tosandboxaligns with the current test environment configuration and appears to be a valid update.apps/api/src/rest-app.ts (1)
200-204: LGTM! Disposal now centralized via DisposableRegistry.The removal of the
beforeEndhook is correct. Resource disposal is now handled automatically by the container callingDisposableRegistry.dispose()at shutdown, which provides centralized cleanup management.apps/api/src/db/dbConnection.ts (1)
56-66: LGTM! DisposableRegistry integration is correct.The wrapping of the APP_INITIALIZER factory with
DisposableRegistry.registerFromFactoryproperly registers the database connection cleanup for automatic disposal at shutdown. The type constraintsatisfies AppInitializer & Disposableensures compile-time safety.apps/api/src/core/providers/postgres.provider.ts (1)
59-67: LGTM! Consistent DisposableRegistry pattern.The implementation follows the same correct pattern as in
dbConnection.ts, ensuring postgres.js clients are properly cleaned up at shutdown through the DisposableRegistry.apps/api/src/core/lib/disposable-registry/disposable-registry.ts (4)
1-25: LGTM! Clean singleton pattern with delegation.The static method provides a convenient API while properly delegating to the singleton instance. The use of
@singleton()ensures a single registry manages all disposables.
39-49: LGTM! Wrapper correctly registers disposables.The factory wrapper properly detects disposable return values and registers their cleanup callbacks. The implementation correctly assumes factories are synchronous, which aligns with the current usage patterns in
postgres.provider.tsanddbConnection.ts.
62-72: Excellent! Promise.allSettled ensures complete cleanup.The use of
Promise.allSettledcorrectly addresses the past review concern. All disposal operations will be attempted even if some fail, and any failures are properly surfaced viaAggregateError. This guarantees robust resource cleanup at shutdown.
80-82: LGTM! Robust type guard.The type guard correctly handles edge cases (null, undefined, non-objects) and safely narrows the type to
Disposablewhen all checks pass.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/api/env/.env.functional.test (1)
2-5: Address key ordering inconsistency.The environment file has inconsistent key ordering. According to static analysis,
RPC_NODE_ENDPOINT(line 5) should be ordered alphabetically beforeUAKT_TOP_UP_MASTER_WALLET_MNEMONIC(line 2). Consider reorganizing keys alphabetically for consistency and maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/api/env/.env.functional.test(1 hunks)apps/api/src/background-jobs-app.ts(1 hunks)apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts(0 hunks)apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts(0 hunks)apps/api/src/billing/providers/signing-client.provider.ts(0 hunks)apps/api/src/billing/services/dedupe-signing-client/dedupe-signing-client.service.ts(0 hunks)apps/api/src/console.ts(0 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts(1 hunks)apps/api/src/core/lib/disposable-registry/disposable-registry.ts(1 hunks)apps/api/src/core/providers/postgres.provider.ts(2 hunks)apps/api/src/core/services/start-server/start-server.ts(0 hunks)apps/api/src/db/dbConnection.ts(2 hunks)apps/api/src/rest-app.ts(1 hunks)
💤 Files with no reviewable changes (6)
- apps/api/src/billing/providers/signing-client.provider.ts
- apps/api/src/billing/lib/sync-signing-stargate-client/sync-signing-stargate-client.ts
- apps/api/src/console.ts
- apps/api/src/billing/lib/batch-signing-client/batch-signing-client.service.ts
- apps/api/src/core/services/start-server/start-server.ts
- apps/api/src/billing/services/dedupe-signing-client/dedupe-signing-client.service.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/api/src/core/lib/disposable-registry/disposable-registry.spec.ts
- apps/api/src/db/dbConnection.ts
- apps/api/src/core/providers/postgres.provider.ts
- apps/api/src/background-jobs-app.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/api/src/rest-app.tsapps/api/src/core/lib/disposable-registry/disposable-registry.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/api/src/rest-app.tsapps/api/src/core/lib/disposable-registry/disposable-registry.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: The tsyringe container in the Akash Network console project has been extended with a custom dispose() method that iterates over all registered instances and calls dispose() on each one that implements it, enabling proper resource cleanup during shutdown.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
📚 Learning: 2025-08-21T04:03:23.490Z
Learnt from: stalniy
Repo: akash-network/console PR: 1827
File: apps/api/src/console.ts:146-154
Timestamp: 2025-08-21T04:03:23.490Z
Learning: In the Akash Network console project, services like JobQueueService implement dispose() methods for resource cleanup, and the tsyringe container has been extended with a dispose() method that iterates over all registered instances and calls their dispose() methods, enabling proper shutdown orchestration.
Applied to files:
apps/api/src/core/lib/disposable-registry/disposable-registry.ts
🧬 Code graph analysis (1)
apps/api/src/rest-app.ts (1)
apps/api/src/core/providers/postgres.provider.ts (1)
migratePG(27-27)
🪛 dotenv-linter (4.0.0)
apps/api/env/.env.functional.test
[warning] 5-5: [UnorderedKey] The RPC_NODE_ENDPOINT key should go before the UAKT_TOP_UP_MASTER_WALLET_MNEMONIC key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
🔇 Additional comments (3)
apps/api/env/.env.functional.test (1)
5-5: Verify the new RPC endpoint is correct and accessible.The RPC endpoint has been updated from
https://rpc.sandbox-2.aksh.pw:443tohttps://rpc.sandbox.akt.dev/rpc. Ensure that the new endpoint is valid, accessible, and appropriate for the sandbox environment used by functional tests.apps/api/src/core/lib/disposable-registry/disposable-registry.ts (2)
80-82: LGTM!The type guard implementation is solid and correctly identifies objects that implement the Disposable interface. The truthy check, object type check, and function verification provide proper type safety.
39-49: ****tsyringe's FactoryProvider useFactory signature is synchronous:
(dependencyContainer: DependencyContainer) => T, and does not natively support async factories. The review comment's concern is invalid for this codebase.The proposed diff—making the wrapper
async—would break the type contract because it would returnPromise<T>instead ofT, violating tsyringe's expectations for factory registration. Earlier script results confirmed both factories in the codebase (dbConnection.tsandpostgres.provider.ts) are synchronous; they return objects with async methods, not Promises from the factory itself.If async factories were needed, the codebase would require manual async setup before container use, or use @launchtray/tsyringe-async.
No action is required; the code is correct as-is.
Likely an incorrect or invalid review comment.
8bd14e0 to
d9b460a
Compare
Summary by CodeRabbit