Skip to content

Commit c4768ab

Browse files
0xERR0Rtaraspos
authored andcommitted
Remove job history
1 parent 5e68c0d commit c4768ab

File tree

5 files changed

+2
-35
lines changed

5 files changed

+2
-35
lines changed

Diff for: core/common.go

-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ type Job interface {
3232
Use(...Middleware)
3333
Run(*Context) error
3434
Running() int32
35-
History() []*Execution
36-
AddHistory(...*Execution)
3735
NotifyStart()
3836
NotifyStop()
3937
}
@@ -61,7 +59,6 @@ func NewContext(s *Scheduler, j Job, e *Execution) *Context {
6159

6260
func (c *Context) Start() {
6361
c.Execution.Start()
64-
c.Job.AddHistory(c.Execution)
6562
c.Job.NotifyStart()
6663
}
6764

Diff for: core/job.go

-10
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ func (j *BareJob) GetCommand() string {
2828
return j.Command
2929
}
3030

31-
func (j *BareJob) History() []*Execution {
32-
return j.history
33-
}
34-
35-
func (j *BareJob) AddHistory(e ...*Execution) {
36-
j.lock.Lock()
37-
defer j.lock.Unlock()
38-
j.history = append(j.history, e...)
39-
}
40-
4131
func (j *BareJob) Running() int32 {
4232
return atomic.LoadInt32(&j.running)
4333
}

Diff for: core/job_test.go

-13
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ func (s *SuiteBareJob) TestGetters(c *C) {
1818
c.Assert(job.GetCommand(), Equals, "qux")
1919
}
2020

21-
func (s *SuiteBareJob) TestHistory(c *C) {
22-
eA := NewExecution()
23-
eB := NewExecution()
24-
25-
job := &BareJob{}
26-
job.AddHistory(eA, eB)
27-
28-
h := job.History()
29-
c.Assert(h, HasLen, 2)
30-
c.Assert(h[0], DeepEquals, eA)
31-
c.Assert(h[1], DeepEquals, eB)
32-
}
33-
3421
func (s *SuiteBareJob) TestNotifyStartStop(c *C) {
3522
job := &BareJob{}
3623

Diff for: core/localjob_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package core
22

33
import (
4-
"bytes"
4+
"github.com/armon/circbuf"
55

66
. "gopkg.in/check.v1"
77
)
@@ -14,7 +14,7 @@ func (s *SuiteLocalJob) TestRun(c *C) {
1414
job := &LocalJob{}
1515
job.Command = `echo "foo bar"`
1616

17-
b := bytes.NewBuffer(nil)
17+
b, _ := circbuf.NewBuffer(1000)
1818
e := NewExecution()
1919
e.OutputStream = b
2020

Diff for: core/scheduler_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ func (s *SuiteScheduler) TestStartStop(c *C) {
3939

4040
sc.Stop()
4141
c.Assert(sc.IsRunning(), Equals, false)
42-
43-
h := job.History()
44-
c.Assert(h, HasLen, 2)
45-
c.Assert(h[0].IsRunning, Equals, false)
46-
c.Assert(h[0].Date.IsZero(), Equals, false)
47-
c.Assert(h[1].IsRunning, Equals, false)
48-
c.Assert(h[1].Date.IsZero(), Equals, false)
4942
}
5043

5144
func (s *SuiteScheduler) TestMergeMiddlewaresSame(c *C) {

0 commit comments

Comments
 (0)