You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
284 B
24 lines
284 B
5 years ago
|
package task
|
||
|
|
||
|
import "log"
|
||
|
|
||
|
// @Title 任务
|
||
|
func Run() {
|
||
|
// 直播回调任务
|
||
|
go runSync((&Live{}).Run)
|
||
|
}
|
||
|
|
||
|
// @Title 异步调用
|
||
|
func runSync(fun func()) {
|
||
|
for {
|
||
|
func() {
|
||
|
defer func() {
|
||
|
if r := recover(); r != nil {
|
||
|
log.Println(r)
|
||
|
}
|
||
|
}()
|
||
|
fun()
|
||
|
}()
|
||
|
}
|
||
|
}
|