Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8d5ad91f
Commit
8d5ad91f
authored
Feb 03, 2016
by
Prashanth B
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20624 from bprashanth/kp-channel
Make sure at least one interrupt is buffered before dropping.
parents
f3429776
f9b96d2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
config.go
pkg/proxy/config/config.go
+10
-2
config_test.go
pkg/proxy/config/config_test.go
+5
-0
No files found.
pkg/proxy/config/config.go
View file @
8d5ad91f
...
@@ -82,7 +82,11 @@ type EndpointsConfig struct {
...
@@ -82,7 +82,11 @@ type EndpointsConfig struct {
// NewEndpointsConfig creates a new EndpointsConfig.
// NewEndpointsConfig creates a new EndpointsConfig.
// It immediately runs the created EndpointsConfig.
// It immediately runs the created EndpointsConfig.
func
NewEndpointsConfig
()
*
EndpointsConfig
{
func
NewEndpointsConfig
()
*
EndpointsConfig
{
updates
:=
make
(
chan
struct
{})
// The updates channel is used to send interrupts to the Endpoints handler.
// It's buffered because we never want to block for as long as there is a
// pending interrupt, but don't want to drop them if the handler is doing
// work.
updates
:=
make
(
chan
struct
{},
1
)
store
:=
&
endpointsStore
{
updates
:
updates
,
endpoints
:
make
(
map
[
string
]
map
[
types
.
NamespacedName
]
api
.
Endpoints
)}
store
:=
&
endpointsStore
{
updates
:
updates
,
endpoints
:
make
(
map
[
string
]
map
[
types
.
NamespacedName
]
api
.
Endpoints
)}
mux
:=
config
.
NewMux
(
store
)
mux
:=
config
.
NewMux
(
store
)
bcaster
:=
config
.
NewBroadcaster
()
bcaster
:=
config
.
NewBroadcaster
()
...
@@ -187,7 +191,11 @@ type ServiceConfig struct {
...
@@ -187,7 +191,11 @@ type ServiceConfig struct {
// NewServiceConfig creates a new ServiceConfig.
// NewServiceConfig creates a new ServiceConfig.
// It immediately runs the created ServiceConfig.
// It immediately runs the created ServiceConfig.
func
NewServiceConfig
()
*
ServiceConfig
{
func
NewServiceConfig
()
*
ServiceConfig
{
updates
:=
make
(
chan
struct
{})
// The updates channel is used to send interrupts to the Services handler.
// It's buffered because we never want to block for as long as there is a
// pending interrupt, but don't want to drop them if the handler is doing
// work.
updates
:=
make
(
chan
struct
{},
1
)
store
:=
&
serviceStore
{
updates
:
updates
,
services
:
make
(
map
[
string
]
map
[
types
.
NamespacedName
]
api
.
Service
)}
store
:=
&
serviceStore
{
updates
:
updates
,
services
:
make
(
map
[
string
]
map
[
types
.
NamespacedName
]
api
.
Service
)}
mux
:=
config
.
NewMux
(
store
)
mux
:=
config
.
NewMux
(
store
)
bcaster
:=
config
.
NewBroadcaster
()
bcaster
:=
config
.
NewBroadcaster
()
...
...
pkg/proxy/config/config_test.go
View file @
8d5ad91f
...
@@ -348,3 +348,8 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
...
@@ -348,3 +348,8 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
handler
.
ValidateEndpoints
(
t
,
endpoints
)
handler
.
ValidateEndpoints
(
t
,
endpoints
)
handler2
.
ValidateEndpoints
(
t
,
endpoints
)
handler2
.
ValidateEndpoints
(
t
,
endpoints
)
}
}
// TODO: Add a unittest for interrupts getting processed in a timely manner.
// Currently this module has a circular dependency with config, and so it's
// named config_test, which means even test methods need to be public. This
// is refactoring that we can avoid by resolving the dependency.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment