當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。