当前位置: 首页>>代码示例>>Golang>>正文


Golang scheduler.Scheduler类代码示例

本文整理汇总了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)
	}
}
开发者ID:bhepp,项目名称:cgrates,代码行数:11,代码来源:registration.go

示例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()
	}
}
开发者ID:kevinlovesing,项目名称:cgrates,代码行数:13,代码来源:registration.go

示例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
}
开发者ID:cgrates,项目名称:cgrates,代码行数:18,代码来源:servmanager.go


注:本文中的github.com/cgrates/cgrates/scheduler.Scheduler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。