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
26593f1a
Commit
26593f1a
authored
Dec 12, 2015
by
James DeFelice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use WithoutCancel interface w/ Pop(nil)
parent
af95e3fe
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
+11
-10
offers.go
contrib/mesos/pkg/offers/offers.go
+1
-1
delay_test.go
contrib/mesos/pkg/queue/delay_test.go
+2
-2
historical_test.go
contrib/mesos/pkg/queue/historical_test.go
+7
-7
interface.go
contrib/mesos/pkg/queue/interface.go
+1
-0
No files found.
contrib/mesos/pkg/offers/offers.go
View file @
26593f1a
...
...
@@ -441,7 +441,7 @@ func (s *offerStorage) ageOffers() {
}
func
(
s
*
offerStorage
)
nextListener
()
*
offerListener
{
obj
:=
s
.
listeners
.
Pop
(
nil
)
obj
:=
s
.
listeners
.
Pop
(
queue
.
WithoutCancel
()
)
if
listen
,
ok
:=
obj
.
(
*
offerListener
);
!
ok
{
//programming error
panic
(
fmt
.
Sprintf
(
"unexpected listener object %v"
,
obj
))
...
...
contrib/mesos/pkg/queue/delay_test.go
View file @
26593f1a
...
...
@@ -358,7 +358,7 @@ func TestDFIFO_sanity_check(t *testing.T) {
// pop last
before
:=
time
.
Now
()
x
:=
df
.
Pop
(
nil
)
x
:=
df
.
Pop
(
WithoutCancel
()
)
assert
.
Equal
(
a
.
(
*
testjob
)
.
instance
,
2
)
now
:=
time
.
Now
()
...
...
@@ -395,7 +395,7 @@ func TestDFIFO_Offer(t *testing.T) {
}
before
:=
time
.
Now
()
x
:=
dq
.
Pop
(
nil
)
x
:=
dq
.
Pop
(
WithoutCancel
()
)
now
:=
time
.
Now
()
waitPeriod
:=
now
.
Sub
(
before
)
...
...
contrib/mesos/pkg/queue/historical_test.go
View file @
26593f1a
...
...
@@ -75,7 +75,7 @@ func TestFIFO_basic(t *testing.T) {
lastInt
:=
_int
(
0
)
lastUint
:=
_uint
(
0
)
for
i
:=
0
;
i
<
amount
*
2
;
i
++
{
switch
obj
:=
f
.
Pop
(
nil
)
.
(
type
)
{
switch
obj
:=
f
.
Pop
(
WithoutCancel
()
)
.
(
type
)
{
case
_int
:
if
obj
<=
lastInt
{
t
.
Errorf
(
"got %v (int) out of order, last was %v"
,
obj
,
lastInt
)
...
...
@@ -100,7 +100,7 @@ func TestFIFO_addUpdate(t *testing.T) {
got
:=
make
(
chan
*
testObj
,
2
)
go
func
()
{
for
{
got
<-
f
.
Pop
(
nil
)
.
(
*
testObj
)
got
<-
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
}
}()
...
...
@@ -126,7 +126,7 @@ func TestFIFO_addReplace(t *testing.T) {
got
:=
make
(
chan
*
testObj
,
2
)
go
func
()
{
for
{
got
<-
f
.
Pop
(
nil
)
.
(
*
testObj
)
got
<-
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
}
}()
...
...
@@ -158,24 +158,24 @@ func TestFIFO_detectLineJumpers(t *testing.T) {
done
:=
make
(
chan
struct
{})
go
func
()
{
defer
close
(
done
)
if
e
,
a
:=
13
,
f
.
Pop
(
nil
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
if
e
,
a
:=
13
,
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
err
=
fmt
.
Errorf
(
"expected %d, got %d"
,
e
,
a
)
return
}
f
.
Add
(
&
testObj
{
"foo"
,
14
})
// ensure foo doesn't jump back in line
if
e
,
a
:=
1
,
f
.
Pop
(
nil
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
if
e
,
a
:=
1
,
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
err
=
fmt
.
Errorf
(
"expected %d, got %d"
,
e
,
a
)
return
}
if
e
,
a
:=
30
,
f
.
Pop
(
nil
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
if
e
,
a
:=
30
,
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
err
=
fmt
.
Errorf
(
"expected %d, got %d"
,
e
,
a
)
return
}
if
e
,
a
:=
14
,
f
.
Pop
(
nil
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
if
e
,
a
:=
14
,
f
.
Pop
(
WithoutCancel
()
)
.
(
*
testObj
)
.
value
;
a
!=
e
{
err
=
fmt
.
Errorf
(
"expected %d, got %d"
,
e
,
a
)
return
}
...
...
contrib/mesos/pkg/queue/interface.go
View file @
26593f1a
...
...
@@ -102,4 +102,5 @@ type UniqueDeadlined interface {
Deadlined
}
// WithoutCancel returns a chan that may never be closed and always blocks
func
WithoutCancel
()
<-
chan
struct
{}
{
return
nil
}
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