Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: always initialize mediator #985

Merged

Conversation

niall-shaw
Copy link
Contributor

@niall-shaw niall-shaw commented Aug 18, 2022

Always initialize the mediator during agent.initialize(), to prevent attempts to initialize twice due to parallelism

@niall-shaw niall-shaw requested a review from a team as a code owner August 18, 2022 08:04
@niall-shaw niall-shaw mentioned this pull request Aug 18, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2022

Codecov Report

Merging #985 (551b767) into main (d8a30d9) will decrease coverage by 0.00%.
The diff coverage is 94.11%.

@@            Coverage Diff             @@
##             main     #985      +/-   ##
==========================================
- Coverage   88.18%   88.17%   -0.01%     
==========================================
  Files         487      487              
  Lines       11544    11548       +4     
  Branches     1921     1921              
==========================================
+ Hits        10180    10183       +3     
- Misses       1304     1305       +1     
  Partials       60       60              
Impacted Files Coverage Δ
...re/src/modules/routing/services/MediatorService.ts 91.57% <92.85%> (-0.98%) ⬇️
packages/core/src/agent/Agent.ts 95.34% <100.00%> (+0.02%) ⬆️
...ackages/core/src/modules/routing/MediatorModule.ts 81.63% <100.00%> (+0.78%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Add mediationRole property to AgentConfig to ensure MediatorModule is initialized correctly. This prevents concurrency issues when multiple attempts to create a mediatorRoutingRecord fail.

Signed-off-by: Niall Shaw <[email protected]>
always initialize mediator

Signed-off-by: Niall Shaw <[email protected]>
@niall-shaw niall-shaw force-pushed the feat/always-initialize-mediator branch from 092f5f7 to 9e82a84 Compare August 18, 2022 09:36
Copy link
Contributor

@genaris genaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @niallshaw-absa! I've seen that some tests failed. Are they working locally for you? Maybe it'll be needed to update snapshots as now the mediator routing record is created at the start.

@niall-shaw
Copy link
Contributor Author

Thanks @niallshaw-absa! I've seen that some tests failed. Are they working locally for you? Maybe it'll be needed to update snapshots as now the mediator routing record is created at the start.

@genaris - tests are failing for me locally also, if possible can you show me how to update the snapshots? Thanks!

@genaris
Copy link
Contributor

genaris commented Aug 19, 2022

Thanks @niallshaw-absa! I've seen that some tests failed. Are they working locally for you? Maybe it'll be needed to update snapshots as now the mediator routing record is created at the start.

@genaris - tests are failing for me locally also, if possible can you show me how to update the snapshots? Thanks!

To update snapshots you need to add -u parameter to yarn test. However it was not enough, because this new behaviour implied the generation of a different record each time (as routing key changed), so I've added some mocks on DID generation for that particular test suite.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
8.4% 8.4% Duplication

@genaris genaris enabled auto-merge (squash) August 19, 2022 16:25
@genaris genaris merged commit b699977 into openwallet-foundation:main Aug 19, 2022
@niall-shaw niall-shaw deleted the feat/always-initialize-mediator branch August 8, 2023 10:04
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.

Mediation issues with multiple agents attempting to connect concurrently
3 participants