MCPcopy
hub / github.com/aceld/zinx / Poll3

Function Poll3

examples/zinx_RequestPollMode/pool_mode_server/PoolModeServer.go:46–52  ·  view source on GitHub ↗

如果请求的次数多,则开启对象池且直接传递不copy Request 就可能导致值不一致

(request ziface.IRequest)

Source from the content-addressed store, hash-verified

44
45// 如果请求的次数多,则开启对象池且直接传递不copy Request 就可能导致值不一致
46func Poll3(request ziface.IRequest) {
47 time.Sleep(time.Second * 3)
48 get, _ := request.Get("num")
49 // 池化对象如果直接传递被影响可能随机打印被修改的值 3
50 fmt.Printf("num:%v \n", get)
51
52}
53
54func Poll4(request ziface.IRequest) {
55 // 影响原本的 request 对象

Callers 1

Poll1Function · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected