本文整理汇总了Golang中github.com/tideland/golib/loop.Recoverings类的典型用法代码示例。如果您正苦于以下问题:Golang Recoverings类的具体用法?Golang Recoverings怎么用?Golang Recoverings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Recoverings类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: checkRecovering
// checkRecovering checks if the backend can be recovered.
func (c *Crontab) checkRecovering(rs loop.Recoverings) (loop.Recoverings, error) {
if rs.Frequency(12, time.Minute) {
logger.Errorf("crontab cannot be recovered: %v", rs.Last().Reason)
return nil, errors.New(ErrCrontabCannotBeRecovered, errorMessages, rs.Last().Reason)
}
logger.Warningf("crontab recovered: %v", rs.Last().Reason)
return rs.Trim(12), nil
}
开发者ID:jmptrader,项目名称:golib,代码行数:9,代码来源:timex.go
示例2: checkRecovering
// checkRecovering checks if the backend can be recovered.
func (b *stdBackend) checkRecovering(rs loop.Recoverings) (loop.Recoverings, error) {
if rs.Frequency(12, time.Minute) {
logger.Errorf("standard monitor cannot be recovered: %v", rs.Last().Reason)
return nil, errors.New(ErrMonitoringCannotBeRecovered, errorMessages, rs.Last().Reason)
}
logger.Warningf("standard monitor recovered: %v", rs.Last().Reason)
return rs.Trim(12), nil
}
开发者ID:postfix,项目名称:golib,代码行数:9,代码来源:standardbackend.go
示例3: catchTimeout
func catchTimeout(rs loop.Recoverings) (loop.Recoverings, error) {
if len(rs) > 0 {
if err, ok := rs.Last().Reason.(error); ok {
if err.Error() == "timed out" {
return nil, err
}
}
}
return nil, nil
}
开发者ID:kung-foo,项目名称:golib,代码行数:10,代码来源:loop_test.go
示例4: checkRecovering
// checkRecovering checks if the cell may recover after a panic. It will
// signal an error and let the cell stop working if there have been 12 recoverings
// during the last minute or the behaviors Recover() signals, that it cannot
// handle the error.
func (c *cell) checkRecovering(rs loop.Recoverings) (loop.Recoverings, error) {
logger.Warningf("recovering cell %q after error: %v", c.id, rs.Last().Reason)
// Check frequency.
if rs.Frequency(c.recoveringNumber, c.recoveringDuration) {
err := errors.New(ErrRecoveredTooOften, errorMessages, rs.Last().Reason)
logger.Errorf("recovering frequency of cell %q too high", c.id)
return nil, err
}
// Try to recover.
if err := c.behavior.Recover(rs.Last().Reason); err != nil {
err := errors.Annotate(err, ErrEventRecovering, errorMessages, rs.Last().Reason)
logger.Errorf("recovering of cell %q failed: %v", c.id, err)
return nil, err
}
logger.Infof("successfully recovered cell %q", c.id)
return rs.Trim(c.recoveringNumber), nil
}
开发者ID:tideland,项目名称:gocells,代码行数:21,代码来源:cell.go
示例5: checkRecovering
// checkRecovering checks if the cell may recover after a panic. It will
// signal an error and let the cell stop working if there have been 12 recoverings
// during the last minute or the behaviors Recover() signals, that it cannot
// handle the error.
func (c *cell) checkRecovering(rs loop.Recoverings) (loop.Recoverings, error) {
logger.Errorf("recovering cell %q after error: %v", c.id, rs.Last().Reason)
// Check frequency.
if rs.Frequency(c.recoveringNumber, c.recoveringDuration) {
return nil, errors.New(ErrRecoveredTooOften, errorMessages, rs.Last().Reason)
}
// Try to recover.
if err := c.behavior.Recover(rs.Last().Reason); err != nil {
return nil, errors.Annotate(err, ErrEventRecovering, errorMessages, rs.Last().Reason)
}
return rs.Trim(c.recoveringNumber), nil
}
开发者ID:jmptrader,项目名称:golib,代码行数:16,代码来源:cell.go
注:本文中的github.com/tideland/golib/loop.Recoverings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论