http://www.chengweiyang.cn/gitbook/index.html[......]
Leave a reply
peewee解决问题"OperationalError: (2006, 'MySQL server has gone away')"
用过MySQL的应该都知道,MySQL默认长链接只能保持8小时,超过后就会自动断开。
在peewee中如何维持长连接呢?
解决方法比较晦涩,需要自定义一个支持重试的mixin,然后自定义一种RetryMySQLDatabase混入mixin
from peewee import *
from peewee import __exception_wrapper__
class RetryOperationalError(object):
def execute[......]
SpringBoot中定时任务执行的坑
在sb中,支持多种定时执行模式(cron, fixRate, fixDelay),开启也非常简单:
1、在Application或者其他Autoconfig上
@EnableScheduling
2、在需要定时执行的函数上
@Scheduled(fixedDelayString = "${config.timeInMs}")
@Scheduled(cron = "${config.cronStr}")
不过这里有个小坑,默认这个schedule只使用一个线程。
如果你在多个[......]
自持域名Email转发利器
gerrit进行push review的自定义函数
review() {
branchName=`git rev-parse --abbrev-ref HEAD`
branchAndTopic="${branchName}"
if [ x"$1" != x"" ]; then
branchAndTopic="${branchName}""/"$1
fi
git push origin HEAD:refs/for/${branchAndTopic}%r=liheyuan[......]