Make NewManager actually create a new provider #1

Merged
lunny merged 2 commits from zeripath/session:new-manager-new-provider into master 2021-09-13 06:47:32 +00:00
Owner

The current code for NewManager means that the same provider is reinitialised
leading to a potential datarace on reinitialisation.

This PR simply causes the NewManager to reinstatiate the selected provider.

Signed-off-by: Andrew Thornton art27@cantab.net

The current code for NewManager means that the same provider is reinitialised leading to a potential datarace on reinitialisation. This PR simply causes the NewManager to reinstatiate the selected provider. Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added 1 commit 2021-09-12 16:13:12 +00:00
Make NewManager actually create a new provider
The current code for NewManager means that the same provider is reinitialised
leading to a potential datarace on reinitialisation.

This PR simply causes the NewManager to reinstatiate the selected provider.

Signed-off-by: Andrew Thornton <art27@cantab.net>
All checks were successful
continuous-integration/drone/pr Build is passing
e6b0458ddd
lunny reviewed 2021-09-12 16:48:21 +00:00
session.go Outdated
@ -322,2 +322,3 @@
// It returns an error when requested provider name isn't registered.
func NewManager(name string, opt Options) (*Manager, error) {
p, ok := providers[name]
exemplar, ok := providers[name]
Owner

I think storing the value as a function to create provider is better.

I think storing the value as a function to create provider is better.
lunny marked this conversation as resolved
6543 approved these changes 2021-09-12 16:49:28 +00:00
Owner

waiting as per lunny ...

waiting as per lunny ...
Author
Owner

That breaks the API - which is fine but this change can just be merged without changing the API.

That breaks the API - which is fine but this change can just be merged without changing the API.
zeripath added 1 commit 2021-09-12 17:19:24 +00:00
as per lunny
Signed-off-by: Andrew Thornton <art27@cantab.net>
Some checks failed
continuous-integration/drone/pr Build is failing
74b5bb6d0b
zeripath force-pushed new-manager-new-provider from 74b5bb6d0b to 14eb9ee2f7 2021-09-12 17:20:30 +00:00 Compare
Author
Owner

OK

We now have a RegisterFn(name string, providerFn func() Provider) function which Register(name string, provider Provider) calls into with the results of the old newProvider function.

OK We now have a `RegisterFn(name string, providerFn func() Provider)` function which `Register(name string, provider Provider)` calls into with the results of the old newProvider function.
lunny approved these changes 2021-09-13 06:47:16 +00:00
lunny merged commit 2ac132b0fa into master 2021-09-13 06:47:32 +00:00
zeripath deleted branch new-manager-new-provider 2021-09-13 07:26:46 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: go-chi/session#1
No description provided.