本文整理汇总了Golang中github.com/cgrates/cgrates/scheduler.Scheduler类的典型用法代码示例。如果您正苦于以下问题:Golang Scheduler类的具体用法?Golang Scheduler怎么用?Golang Scheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Scheduler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: reloadSchedulerSingnalHandler
// Listens for the HUP system signal and gracefuly reloads the timers from database.
func reloadSchedulerSingnalHandler(sched *scheduler.Scheduler, getter engine.RatingStorage) {
for {
c := make(chan os.Signal)
signal.Notify(c, syscall.SIGHUP)
sig := <-c
utils.Logger.Info(fmt.Sprintf("Caught signal %v, reloading action timings.\n", sig))
sched.Reload(true)
}
}
示例2: reloadSchedulerSingnalHandler
// Listens for the HUP system signal and gracefuly reloads the timers from database.
func reloadSchedulerSingnalHandler(sched *scheduler.Scheduler, getter engine.RatingStorage) {
for {
c := make(chan os.Signal)
signal.Notify(c, syscall.SIGHUP)
sig := <-c
utils.Logger.Info(fmt.Sprintf("Caught signal %v, reloading action timings.\n", sig))
sched.LoadActionPlans(getter)
// check the tip of the queue for new actions
sched.Restart()
}
}
示例3: StopScheduler
func (srvMngr *ServiceManager) StopScheduler() error {
var sched *scheduler.Scheduler
srvMngr.Lock()
if srvMngr.sched != nil {
sched = srvMngr.sched
srvMngr.sched = nil // optimize the lock and release here
}
srvMngr.Unlock()
if sched == nil {
return utils.NewCGRError(utils.ServiceManager,
utils.CapitalizedMessage(utils.ServiceAlreadyRunning),
utils.ServiceAlreadyRunning,
"the scheduler is not running")
}
srvMngr.cfg.SchedulerEnabled = false
sched.Shutdown()
return nil
}