Skip to content

fix: assets reinitialization on TradeRouterService rpc re-connection and minor UI fixes#28

Merged
muddlebee merged 7 commits intodevfrom
router-v2
Jul 31, 2025
Merged

fix: assets reinitialization on TradeRouterService rpc re-connection and minor UI fixes#28
muddlebee merged 7 commits intodevfrom
router-v2

Conversation

@muddlebee
Copy link
Member

No description provided.

…rvice

- Updated the error handling in the TradeRouterService to utilize a new `fullCleanup` method, ensuring a more thorough reset of the service state upon initialization failure. This change improves the reliability of the service by ensuring that all relevant properties are reset, preventing potential issues from lingering state.
- The `cleanup` method has been modified to preserve the `lastInitializedAssets`, allowing for potential reinitialization without losing previously stored data. This design choice balances the need for a clean state with the efficiency of retaining useful information for future operations.
- Additionally, clarified comments in the `ConnectionManager` to indicate that observer notifications are now handled in the `connectToNetwork` method, reducing the risk of race conditions and improving code maintainability.
…ability

- Introduced a new script, `test-connection-resilience.ts`, to systematically test the connection resilience of the application. This script simulates connection drops and reconnections, ensuring that the system can handle network instability effectively.
- The testing process includes multiple phases: initial setup, connection drop simulation, reconnection handling, and functionality verification of the TradeRouter. This comprehensive approach allows for thorough validation of the connection management logic and asset preservation during network disruptions.
- Additionally, enhancements were made to the `initializeSDK` method to ensure that the TradeRouter can initialize independently of external assets, improving its robustness during startup. The `FetchAssetService` was also updated to include better error handling and checks for the availability of the TradeRouter, ensuring that asset enrichment processes are resilient to initialization states.
@muddlebee
Copy link
Member Author

bugbot run

cursor[bot]

This comment was marked as outdated.

- Introduced a `restorationTimeoutId` property to manage restoration timeouts effectively, preventing race conditions during network reconnections. This change ensures that any pending restoration processes are canceled before initiating a new one, improving the reliability of the service.
- Removed the `lastInitializedAssets` array, as it is no longer necessary to store external assets, simplifying the state management within the service. This decision aligns with the goal of maintaining a self-contained initialization process for the TradeRouter.
- Updated the `cleanup` and `fullCleanup` methods to consistently clear the restoration timeout, ensuring a clean state during service resets. These modifications enhance the overall maintainability and robustness of the TradeRouterService, allowing for smoother operation during network fluctuations.
@muddlebee
Copy link
Member Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@muddlebee
Copy link
Member Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@muddlebee
Copy link
Member Author

bugbot run

1 similar comment
@muddlebee
Copy link
Member Author

bugbot run

@muddlebee muddlebee changed the title fix: enhance error handling and cleanup process in TradeRouterService fix: reconnection on TradeRouterService after disconnection and minor UI fixes Jul 31, 2025
@muddlebee muddlebee changed the title fix: reconnection on TradeRouterService after disconnection and minor UI fixes fix: assets reinitialization on TradeRouterService rpc re-connection and minor UI fixes Jul 31, 2025
@muddlebee muddlebee merged commit 70c68b9 into dev Jul 31, 2025
2 checks passed
@muddlebee muddlebee deleted the router-v2 branch August 2, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant