本文整理匯總了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
}