Fix job encode decode
This commit is contained in:
9
scheduler/scheduler.go
Normal file → Executable file
9
scheduler/scheduler.go
Normal file → Executable file
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"local/firestormy/config"
|
||||
"local/firestormy/config/ns"
|
||||
"local/firestormy/logger"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -117,7 +118,7 @@ func (s *Scheduler) Stop() error {
|
||||
}
|
||||
|
||||
func (s *Scheduler) List() ([]*Job, error) {
|
||||
entries, err := config.Store.List(nil)
|
||||
entries, err := config.Store.List(ns.Jobs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -139,7 +140,7 @@ func (s *Scheduler) List() ([]*Job, error) {
|
||||
}
|
||||
|
||||
func (s *Scheduler) loadJobFromStore(k string) (*Job, error) {
|
||||
b, err := config.Store.Get(k)
|
||||
b, err := config.Store.Get(k, ns.Jobs...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -160,7 +161,7 @@ func (s *Scheduler) Add(j *Job) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := config.Store.Set(j.Name, b); err != nil {
|
||||
if err := config.Store.Set(j.Name, b, ns.Jobs...); err != nil {
|
||||
return err
|
||||
}
|
||||
s.running[j.Name] = entryID
|
||||
@@ -178,7 +179,7 @@ func (s *Scheduler) Remove(j *Job) error {
|
||||
if was == is {
|
||||
return ErrJobNotFound
|
||||
}
|
||||
return config.Store.Set(j.Name, nil)
|
||||
return config.Store.Set(j.Name, nil, ns.Jobs...)
|
||||
}
|
||||
|
||||
func (s *Scheduler) getEntry(j *Job) (cron.EntryID, bool) {
|
||||
|
||||
Reference in New Issue
Block a user