mirror of
https://github.com/Fishwaldo/sched.git
synced 2025-07-10 23:18:51 +00:00
Rename Started state to Running
Signed-off-by: Sherif Abdel-Naby <sherifabdlnaby@gmail.com>
This commit is contained in:
parent
e7bf70c3e0
commit
980d96a4da
1 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ type State int64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NEW State = iota
|
NEW State = iota
|
||||||
STARTED
|
RUNNING
|
||||||
FINISHED
|
FINISHED
|
||||||
PANICKED
|
PANICKED
|
||||||
)
|
)
|
||||||
|
@ -69,7 +69,7 @@ func (j *Job) Start() error {
|
||||||
func (j *Job) start() (err error) {
|
func (j *Job) start() (err error) {
|
||||||
j.mx.RLock()
|
j.mx.RLock()
|
||||||
if j.state != NEW {
|
if j.state != NEW {
|
||||||
if j.state == STARTED {
|
if j.state == RUNNING {
|
||||||
err = ErrorJobStarted{Message: "job already started"}
|
err = ErrorJobStarted{Message: "job already started"}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func (j *Job) start() (err error) {
|
||||||
j.mx.RUnlock()
|
j.mx.RUnlock()
|
||||||
|
|
||||||
j.mx.Lock()
|
j.mx.Lock()
|
||||||
j.state = STARTED
|
j.state = RUNNING
|
||||||
j.startTime = time.Now()
|
j.startTime = time.Now()
|
||||||
|
|
||||||
// Handle Panics and set correct state
|
// Handle Panics and set correct state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue