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
4fb368e5
Unverified
Commit
4fb368e5
authored
Nov 14, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70801 from Adirio/deltafifo-cleanup
DeltaFIFO cleanup
parents
e3ddaaad
0b16c43f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
delta_fifo.go
staging/src/k8s.io/client-go/tools/cache/delta_fifo.go
+6
-14
No files found.
staging/src/k8s.io/client-go/tools/cache/delta_fifo.go
View file @
4fb368e5
...
@@ -320,17 +320,15 @@ func (f *DeltaFIFO) queueActionLocked(actionType DeltaType, obj interface{}) err
...
@@ -320,17 +320,15 @@ func (f *DeltaFIFO) queueActionLocked(actionType DeltaType, obj interface{}) err
newDeltas
:=
append
(
f
.
items
[
id
],
Delta
{
actionType
,
obj
})
newDeltas
:=
append
(
f
.
items
[
id
],
Delta
{
actionType
,
obj
})
newDeltas
=
dedupDeltas
(
newDeltas
)
newDeltas
=
dedupDeltas
(
newDeltas
)
_
,
exists
:=
f
.
items
[
id
]
if
len
(
newDeltas
)
>
0
{
if
len
(
newDeltas
)
>
0
{
if
!
exists
{
if
_
,
exists
:=
f
.
items
[
id
];
!
exists
{
f
.
queue
=
append
(
f
.
queue
,
id
)
f
.
queue
=
append
(
f
.
queue
,
id
)
}
}
f
.
items
[
id
]
=
newDeltas
f
.
items
[
id
]
=
newDeltas
f
.
cond
.
Broadcast
()
f
.
cond
.
Broadcast
()
}
else
if
exists
{
}
else
{
// We need to remove this from our map (extra items
// We need to remove this from our map (extra items in the queue are
// in the queue are ignored if they are not in the
// ignored if they are not in the map).
// map).
delete
(
f
.
items
,
id
)
delete
(
f
.
items
,
id
)
}
}
return
nil
return
nil
...
@@ -348,9 +346,6 @@ func (f *DeltaFIFO) List() []interface{} {
...
@@ -348,9 +346,6 @@ func (f *DeltaFIFO) List() []interface{} {
func
(
f
*
DeltaFIFO
)
listLocked
()
[]
interface
{}
{
func
(
f
*
DeltaFIFO
)
listLocked
()
[]
interface
{}
{
list
:=
make
([]
interface
{},
0
,
len
(
f
.
items
))
list
:=
make
([]
interface
{},
0
,
len
(
f
.
items
))
for
_
,
item
:=
range
f
.
items
{
for
_
,
item
:=
range
f
.
items
{
// Copy item's slice so operations on this slice
// won't interfere with the object we return.
item
=
copyDeltas
(
item
)
list
=
append
(
list
,
item
.
Newest
()
.
Object
)
list
=
append
(
list
,
item
.
Newest
()
.
Object
)
}
}
return
list
return
list
...
@@ -398,10 +393,7 @@ func (f *DeltaFIFO) GetByKey(key string) (item interface{}, exists bool, err err
...
@@ -398,10 +393,7 @@ func (f *DeltaFIFO) GetByKey(key string) (item interface{}, exists bool, err err
func
(
f
*
DeltaFIFO
)
IsClosed
()
bool
{
func
(
f
*
DeltaFIFO
)
IsClosed
()
bool
{
f
.
closedLock
.
Lock
()
f
.
closedLock
.
Lock
()
defer
f
.
closedLock
.
Unlock
()
defer
f
.
closedLock
.
Unlock
()
if
f
.
closed
{
return
f
.
closed
return
true
}
return
false
}
}
// Pop blocks until an item is added to the queue, and then returns it. If
// Pop blocks until an item is added to the queue, and then returns it. If
...
@@ -432,10 +424,10 @@ func (f *DeltaFIFO) Pop(process PopProcessFunc) (interface{}, error) {
...
@@ -432,10 +424,10 @@ func (f *DeltaFIFO) Pop(process PopProcessFunc) (interface{}, error) {
}
}
id
:=
f
.
queue
[
0
]
id
:=
f
.
queue
[
0
]
f
.
queue
=
f
.
queue
[
1
:
]
f
.
queue
=
f
.
queue
[
1
:
]
item
,
ok
:=
f
.
items
[
id
]
if
f
.
initialPopulationCount
>
0
{
if
f
.
initialPopulationCount
>
0
{
f
.
initialPopulationCount
--
f
.
initialPopulationCount
--
}
}
item
,
ok
:=
f
.
items
[
id
]
if
!
ok
{
if
!
ok
{
// Item may have been deleted subsequently.
// Item may have been deleted subsequently.
continue
continue
...
...
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