diff --git a/xserver/cron.go b/xserver/cron.go index 85556a3..6b4cb83 100644 --- a/xserver/cron.go +++ b/xserver/cron.go @@ -5,23 +5,23 @@ import ( "github.com/robfig/cron" ) -type cronServer struct { +type Cron struct { cr *cron.Cron err error } -func NewCron() *cronServer { +func NewCron() *Cron { cr := cron.New() - return &cronServer{ + return &Cron{ cr: cr, } } -func (c *cronServer) Register(spec string, fun func()) error { +func (c *Cron) Register(spec string, fun func()) error { return c.cr.AddFunc(spec, fun) } -func (c *cronServer) Start() error { +func (c *Cron) Start() error { if c.err != nil { return c.err } @@ -29,11 +29,11 @@ func (c *cronServer) Start() error { return nil } -func (c *cronServer) Shutdown(ctx context.Context) error { +func (c *Cron) Shutdown(ctx context.Context) error { c.cr.Stop() return nil } -func (c *cronServer) Name() string { +func (c *Cron) Name() string { return "cron" }