Ai
1 Star 0 Fork 0

wuzpdev/goworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
async_test.go 467 Bytes
一键复制 编辑 原始数据 按行查看 历史
seis 提交于 2017-10-15 02:01 +08:00 . mongodb uses async module for async jobs
package async
import (
"sync"
"testing"
"time"
"github.com/xiaonanln/goworld/engine/post"
)
func TestNewAsyncJob(t *testing.T) {
var wait sync.WaitGroup
wait.Add(2)
AppendAsyncJob("1", func() (res interface{}, err error) {
wait.Done()
return 1, nil
}, func(res interface{}, err error) {
println("returns", res.(int), err)
wait.Done()
})
wait.Wait()
}
func init() {
go func() {
for {
post.Tick()
time.Sleep(time.Millisecond)
}
}()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuzpdev/goworld.git
git@gitee.com:wuzpdev/goworld.git
wuzpdev
goworld
goworld
v0.1.0

搜索帮助