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
db1ab237
Unverified
Commit
db1ab237
authored
Apr 08, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76252 from goodluckbot/pod-backoff-rwmutex
Change Mutex to RWMutex for pod backoff
parents
fbc28fd1
b92b0eb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
pod_backoff.go
pkg/scheduler/internal/queue/pod_backoff.go
+5
-5
No files found.
pkg/scheduler/internal/queue/pod_backoff.go
View file @
db1ab237
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
// PodBackoffMap is a structure that stores backoff related information for pods
// PodBackoffMap is a structure that stores backoff related information for pods
type
PodBackoffMap
struct
{
type
PodBackoffMap
struct
{
// lock for performing actions on this PodBackoffMap
// lock for performing actions on this PodBackoffMap
lock
sync
.
Mutex
lock
sync
.
RW
Mutex
// initial backoff duration
// initial backoff duration
initialDuration
time
.
Duration
initialDuration
time
.
Duration
// maximal backoff duration
// maximal backoff duration
...
@@ -49,8 +49,8 @@ func NewPodBackoffMap(initialDuration, maxDuration time.Duration) *PodBackoffMap
...
@@ -49,8 +49,8 @@ func NewPodBackoffMap(initialDuration, maxDuration time.Duration) *PodBackoffMap
// GetBackoffTime returns the time that nsPod completes backoff
// GetBackoffTime returns the time that nsPod completes backoff
func
(
pbm
*
PodBackoffMap
)
GetBackoffTime
(
nsPod
ktypes
.
NamespacedName
)
(
time
.
Time
,
bool
)
{
func
(
pbm
*
PodBackoffMap
)
GetBackoffTime
(
nsPod
ktypes
.
NamespacedName
)
(
time
.
Time
,
bool
)
{
pbm
.
lock
.
Lock
()
pbm
.
lock
.
R
Lock
()
defer
pbm
.
lock
.
Unlock
()
defer
pbm
.
lock
.
R
Unlock
()
if
_
,
found
:=
pbm
.
podAttempts
[
nsPod
];
found
==
false
{
if
_
,
found
:=
pbm
.
podAttempts
[
nsPod
];
found
==
false
{
return
time
.
Time
{},
false
return
time
.
Time
{},
false
}
}
...
@@ -63,8 +63,8 @@ func (pbm *PodBackoffMap) GetBackoffTime(nsPod ktypes.NamespacedName) (time.Time
...
@@ -63,8 +63,8 @@ func (pbm *PodBackoffMap) GetBackoffTime(nsPod ktypes.NamespacedName) (time.Time
// TryBackoffAndWait tries to perform backoff for a non-preempting pod.
// TryBackoffAndWait tries to perform backoff for a non-preempting pod.
// it is invoked from factory.go if util.PodPriorityEnabled() returns false.
// it is invoked from factory.go if util.PodPriorityEnabled() returns false.
func
(
pbm
*
PodBackoffMap
)
TryBackoffAndWait
(
nsPod
ktypes
.
NamespacedName
,
stop
<-
chan
struct
{})
bool
{
func
(
pbm
*
PodBackoffMap
)
TryBackoffAndWait
(
nsPod
ktypes
.
NamespacedName
,
stop
<-
chan
struct
{})
bool
{
pbm
.
lock
.
Lock
()
pbm
.
lock
.
R
Lock
()
defer
pbm
.
lock
.
Unlock
()
defer
pbm
.
lock
.
R
Unlock
()
backoffDuration
:=
pbm
.
calculateBackoffDuration
(
nsPod
)
backoffDuration
:=
pbm
.
calculateBackoffDuration
(
nsPod
)
select
{
select
{
case
<-
time
.
After
(
backoffDuration
)
:
case
<-
time
.
After
(
backoffDuration
)
:
...
...
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