Skip to content

Move scopes inside#3454

Merged
preardon merged 8 commits into
masterfrom
MoveScopesInside
Jan 5, 2025
Merged

Move scopes inside#3454
preardon merged 8 commits into
masterfrom
MoveScopesInside

Conversation

@preardon

@preardon preardon commented Jan 3, 2025

Copy link
Copy Markdown
Member

At the minute the Factory Scope (Dependency injection) is around the command processor, this means that when Publish is called multiple Handlers could share the same scope which would be unexpected by the users.

#3356

As scopes are now done in the Handler Factories Command Processor Providers are no longer needed
@preardon

preardon commented Jan 3, 2025

Copy link
Copy Markdown
Member Author

@iancooper let me know if you're happy with this direction

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

Change in average Code Health of affected files: +0.01 (9.52 -> 9.53)

  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

Comment thread src/Paramore.Brighter.ServiceActivator/Dispatcher.cs

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

Change in average Code Health of affected files: +0.01 (9.52 -> 9.53)

  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

Change in average Code Health of affected files: +0.01 (9.52 -> 9.53)

  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

@iancooper

Copy link
Copy Markdown
Member

@iancooper let me know if you're happy with this direction

When I publish, particularly in parallel, I would expect state to be fresh. I think the problem with reusing scope, is that's not true.

I think we need to ask for a fresh scope for each publish chain.

I like where we are, so hopefully we can do that through the lifetime somehow.

@iancooper

Copy link
Copy Markdown
Member

The only other alternative is to make them transient within the scope i.e. the publish has the scope, the publish chains are transient within that scope.

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.01 (9.52 -> 9.51)

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

Comment thread src/Paramore.Brighter/PipelineBuilder.cs
Comment thread src/Paramore.Brighter/PipelineBuilder.cs

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.01 (9.52 -> 9.51)

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

@preardon preardon marked this pull request as ready for review January 4, 2025 21:50

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.01 (9.50 -> 9.50)

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 3 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

@iancooper iancooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this a solid approach and follows what we would expect the scope to be.

Comment thread src/Paramore.Brighter/CommandProcessor.cs Outdated
Comment thread src/Paramore.Brighter/CommandProcessor.cs Outdated
@preardon preardon merged commit ff8fbbf into master Jan 5, 2025
@preardon preardon deleted the MoveScopesInside branch April 4, 2025 08:10
DevJonny pushed a commit to DevJonny/Brighter that referenced this pull request Feb 28, 2026
* Refactor and remove interperter

* Add scoping to the Handler Factories

* Remove Command Processor provider

As scopes are now done in the Handler Factories Command Processor Providers are no longer needed

* Add ADR

* Have Factory work for Scoped as well as Transient

* Fix Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants