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
b9c8c0fc
Commit
b9c8c0fc
authored
Jun 17, 2016
by
Hongchao Deng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RC: rename wait -> wg
We already have a package called "wait". We should make the name different.
parent
3cc43eb0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
replication_controller.go
pkg/controller/replication/replication_controller.go
+8
-8
No files found.
pkg/controller/replication/replication_controller.go
View file @
b9c8c0fc
...
...
@@ -471,12 +471,12 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
// into a performance bottleneck. We should generate a UID for the pod
// beforehand and store it via ExpectCreations.
rm
.
expectations
.
ExpectCreations
(
rcKey
,
diff
)
wait
:=
sync
.
WaitGroup
{}
w
ait
.
Add
(
diff
)
var
wg
sync
.
WaitGroup
w
g
.
Add
(
diff
)
glog
.
V
(
2
)
.
Infof
(
"Too few %q/%q replicas, need %d, creating %d"
,
rc
.
Namespace
,
rc
.
Name
,
rc
.
Spec
.
Replicas
,
diff
)
for
i
:=
0
;
i
<
diff
;
i
++
{
go
func
()
{
defer
w
ait
.
Done
()
defer
w
g
.
Done
()
if
err
:=
rm
.
podControl
.
CreatePods
(
rc
.
Namespace
,
rc
.
Spec
.
Template
,
rc
);
err
!=
nil
{
// Decrement the expected number of creates because the informer won't observe this pod
glog
.
V
(
2
)
.
Infof
(
"Failed creation, decrementing expectations for controller %q/%q"
,
rc
.
Namespace
,
rc
.
Name
)
...
...
@@ -486,7 +486,7 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
}
}()
}
w
ait
.
Wait
()
w
g
.
Wait
()
}
else
if
diff
>
0
{
if
diff
>
rm
.
burstReplicas
{
diff
=
rm
.
burstReplicas
...
...
@@ -513,11 +513,11 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
// labels on a pod/rc change in a way that the pod gets orphaned, the
// rc will only wake up after the expectation has expired.
rm
.
expectations
.
ExpectDeletions
(
rcKey
,
deletedPodKeys
)
wait
:=
sync
.
WaitGroup
{}
w
ait
.
Add
(
diff
)
var
wg
sync
.
WaitGroup
w
g
.
Add
(
diff
)
for
i
:=
0
;
i
<
diff
;
i
++
{
go
func
(
ix
int
)
{
defer
w
ait
.
Done
()
defer
w
g
.
Done
()
if
err
:=
rm
.
podControl
.
DeletePod
(
rc
.
Namespace
,
filteredPods
[
ix
]
.
Name
,
rc
);
err
!=
nil
{
// Decrement the expected number of deletes because the informer won't observe this deletion
podKey
:=
controller
.
PodKey
(
filteredPods
[
ix
])
...
...
@@ -528,7 +528,7 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
}
}(
i
)
}
w
ait
.
Wait
()
w
g
.
Wait
()
}
}
...
...
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