This commit is contained in:
wzdwc
2020-04-26 07:09:52 +08:00
parent 60fe711929
commit 9aedbd3532
20 changed files with 528 additions and 150 deletions
+4
View File
@@ -4,3 +4,7 @@
{"pid":51857,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:38:24","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"Handshake inactivity timeout","requestTime":"2020-04-22 23:38:24","stack":"Error: Handshake inactivity timeout\n at Handshake.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:160:17)\n at Handshake.emit (events.js:311:20)\n at Handshake._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)\n at Timer._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Timer.js:32:23)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)\n --------------------\n at Protocol._enqueue (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n at Protocol.handshake (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:51:23)\n at PoolConnection.connect (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Connection.js:116:18)\n at Pool.getConnection (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:48:16)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n at new Promise (<anonymous>)\n at Pool.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:12:10)\n at Pool.ret [as getConnection] (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:56:34)\n at Pool.query (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:202:8)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n sql: select now() as currentTime;","total":null,"requestBody":{},"method":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:39:39","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-22 23:39:39","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:43:45","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-22 23:43:45","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:24:57","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:24:57","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:02","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:25:02","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:04","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:25:04","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 22:41:00","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 22:41:00","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
+11
View File
@@ -37,3 +37,14 @@
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:43:45","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-22 23:43:45","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51959,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:45:53","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoSIsImFjY291bnQiOiJjYWkxMTEiLCJ1c2VySWQiOjJ9LCJpYXQiOjE1ODc1NzAzNTMsImV4cCI6MTU4NzU5MTk1M30.QCROHyWqK_5kwhIpE3i2AwOfqsktIcRC7J9FwoZFTX8","requestTime":"2020-04-22 23:45:53","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51959,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:45:53","osUser":"root","osUid":0,"fetchConsumeTime":209,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-22 23:45:53","status":200,"total":null,"requestBody":{"userAccount":"cai111","password":"123"},"url":"/node/user/login"}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:23:56","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoiYyIsImFjY291bnQiOiJjYWkiLCJ1c2VySWQiOjF9LCJpYXQiOjE1ODc2NDgyMzYsImV4cCI6MTU4NzY2OTgzNn0.NLQVoRUOk2eKtPJpXtCoDpCYWkUXSL6vPljR-DKxYh4","requestTime":"2020-04-23 21:23:56","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:23:56","osUser":"root","osUid":0,"fetchConsumeTime":218,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-23 21:23:56","status":200,"total":null,"requestBody":{"userAccount":"cai","password":"123"},"url":"/node/user/login"}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:23:57","osUser":"root","osUid":0,"fetchConsumeTime":110,"level":"INFO","message":"POST /node/game/room info","requestTime":"2020-04-23 21:23:57","status":200,"total":null,"requestBody":{},"url":"/node/game/room"}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:24:15","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShMSIsImFjY291bnQiOiJjYWkxMSIsInVzZXJJZCI6M30sImlhdCI6MTU4NzY0ODI1NSwiZXhwIjoxNTg3NjY5ODU1fQ.__TDymI59M3EkIQDEzsjRGaTiZme4EzcbOKvZRjWoQE","requestTime":"2020-04-23 21:24:15","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:24:15","osUser":"root","osUid":0,"fetchConsumeTime":204,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-23 21:24:15","status":200,"total":null,"requestBody":{"userAccount":"cai11","password":"123"},"url":"/node/user/login"}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:24:57","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:24:57","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:02","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:25:02","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:04","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 21:25:04","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:15","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShIiwiYWNjb3VudCI6ImNhaTExMSIsInVzZXJJZCI6Mn0sImlhdCI6MTU4NzY0ODMxNSwiZXhwIjoxNTg3NjY5OTE1fQ.Ts3MaDk8a6wFvN-TNG25Jvw5WOIjpcJHM3K-PMp-6vc","requestTime":"2020-04-23 21:25:15","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 21:25:15","osUser":"root","osUid":0,"fetchConsumeTime":203,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-23 21:25:15","status":200,"total":null,"requestBody":{"userAccount":"cai111","password":"123"},"url":"/node/user/login"}
{"pid":52898,"nodeVersion":"v12.16.1","launchTime":"2020-04-23 22:41:00","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-23 22:41:00","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
+36
View File
@@ -74,3 +74,39 @@
2020-04-22 23:44:42,500 INFO 51958 [egg:core] dump config after ready, 5ms
2020-04-22 23:51:32,377 INFO 51958 [egg-watcher] Recieved a change event from eventSource: {"event":"change","path":"/Users/jorky/code/TexasPokerGame/server/src/app/core/PokerGame.ts","stat":{"dev":16777220,"mode":33188,"nlink":1,"uid":501,"gid":20,"rdev":0,"blksize":4096,"ino":8594144547,"size":13522,"blocks":32,"atimeMs":1587569691708.252,"mtimeMs":1587570690863.5278,"ctimeMs":1587570690863.5278,"birthtimeMs":1587545680156.9385,"atime":"2020-04-22T15:34:51.708Z","mtime":"2020-04-22T15:51:30.864Z","ctime":"2020-04-22T15:51:30.864Z","birthtime":"2020-04-22T08:54:40.157Z"},"remove":false,"isDirectory":false,"isFile":true}
2020-04-22 23:51:32,585 WARN 51958 [agent:development] reload worker because /Users/jorky/code/TexasPokerGame/server/src/app/core/PokerGame.ts change
2020-04-23 21:20:10,675 INFO 52895 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"agent"}
2020-04-23 21:20:10,684 INFO 52895 [egg:core] dump config after load, 5ms
2020-04-23 21:20:10,734 INFO 52895 [egg-watcher] Start watching: ["/Users/jorky/code/TexasPokerGame/server/src/app","/Users/jorky/code/TexasPokerGame/server/src/lib","/Users/jorky/code/TexasPokerGame/server/src/service","/Users/jorky/code/TexasPokerGame/server/src/config","/Users/jorky/code/TexasPokerGame/server/src/app.ts","/Users/jorky/code/TexasPokerGame/server/src/agent.ts","/Users/jorky/code/TexasPokerGame/server/src/interface.ts"]
2020-04-23 21:20:10,734 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/lib"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/service"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/config"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app.ts"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/agent.ts"
2020-04-23 21:20:10,735 INFO 52895 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/interface.ts"
2020-04-23 21:20:10,736 INFO 52895 [egg-watcher:agent] watcher start success
2020-04-23 21:20:10,823 INFO 52895 [egg:core] dump config after ready, 74ms
2020-04-23 22:40:56,834 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 4284658ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
2020-04-24 00:21:50,021 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 6012576ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
2020-04-24 00:30:09,627 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 459401ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
+43
View File
@@ -214,3 +214,46 @@ hostname: 192.168.0.105
status: 200,
fetchEnd: 1587570353766
}
2020-04-23 21:23:56,163 INFO 52898 [-/192.168.0.101/-/233ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoiYyIsImFjY291bnQiOiJjYWkiLCJ1c2VySWQiOjF9LCJpYXQiOjE1ODc2NDgyMzYsImV4cCI6MTU4NzY2OTgzNn0.NLQVoRUOk2eKtPJpXtCoDpCYWkUXSL6vPljR-DKxYh4
2020-04-23 21:23:56,167 INFO 52898 [-/192.168.0.101/-/237ms POST /node/user/login] {
fetchStart: 1587648235949,
url: '/node/user/login',
requestBody: { userAccount: 'cai', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587648236167
}
2020-04-23 21:23:57,773 INFO 52898 [-/192.168.0.101/-/112ms POST /node/game/room] {
fetchStart: 1587648237662,
url: '/node/game/room',
requestBody: {},
message: 'POST /node/game/room info',
level: 'INFO',
status: 200,
fetchEnd: 1587648237772
}
2020-04-23 21:24:15,611 INFO 52898 [-/192.168.0.101/-/205ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShMSIsImFjY291bnQiOiJjYWkxMSIsInVzZXJJZCI6M30sImlhdCI6MTU4NzY0ODI1NSwiZXhwIjoxNTg3NjY5ODU1fQ.__TDymI59M3EkIQDEzsjRGaTiZme4EzcbOKvZRjWoQE
2020-04-23 21:24:15,612 INFO 52898 [-/192.168.0.101/-/206ms POST /node/user/login] {
fetchStart: 1587648255407,
url: '/node/user/login',
requestBody: { userAccount: 'cai11', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587648255611
}
2020-04-23 21:24:57,588 ERROR 52898 [-/192.168.0.105/-/24ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 21:25:02,486 ERROR 52898 [-/192.168.0.105/-/5ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 21:25:04,225 ERROR 52898 [-/192.168.0.105/-/6ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 21:25:15,562 INFO 52898 [-/192.168.0.105/-/203ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShIiwiYWNjb3VudCI6ImNhaTExMSIsInVzZXJJZCI6Mn0sImlhdCI6MTU4NzY0ODMxNSwiZXhwIjoxNTg3NjY5OTE1fQ.Ts3MaDk8a6wFvN-TNG25Jvw5WOIjpcJHM3K-PMp-6vc
2020-04-23 21:25:15,562 INFO 52898 [-/192.168.0.105/-/204ms POST /node/user/login] {
fetchStart: 1587648315359,
url: '/node/user/login',
requestBody: { userAccount: 'cai111', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587648315562
}
2020-04-23 22:41:00,428 ERROR 52898 [-/192.168.0.101/-/2ms GET /socket.io/?room=652114&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShMSIsImFjY291bnQiOiJjYWkxMSIsInVzZXJJZCI6M30sImlhdCI6MTU4NzY0ODI1NSwiZXhwIjoxNTg3NjY5ODU1fQ.__TDymI59M3EkIQDEzsjRGaTiZme4EzcbOKvZRjWoQE&EIO=3&transport=websocket] room service tick null
+22
View File
@@ -196,3 +196,25 @@ hostname: 192.168.0.105
2020-04-22 23:44:44,198 INFO 51959 [egg-mysql] instance[0] status OK, rds currentTime: Wed Apr 22 2020 23:44:44 GMT+0800 (China Standard Time)
2020-04-22 23:44:44,224 INFO 51959 [egg:core] dump config after ready, 9ms
2020-04-22 23:50:16,776 ERROR 51959 incorrect action: check
2020-04-23 21:20:11,762 INFO 52898 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"application"}
2020-04-23 21:20:11,786 INFO 52898 [egg-multipart] stream mode enable
2020-04-23 21:20:11,850 INFO 52898 [egg-redis] server connecting redis://:***@127.0.0.1:6379/0
2020-04-23 21:20:11,866 INFO 52898 [egg-mysql] connecting root@47.104.172.100:3306/poker
2020-04-23 21:20:12,038 INFO 52898 [egg-static] starting static serve /public/ -> /Users/jorky/code/TexasPokerGame/server/src/app/public
2020-04-23 21:20:12,040 INFO 52898 [egg-security] use noopen middleware
2020-04-23 21:20:12,040 INFO 52898 [egg-security] use nosniff middleware
2020-04-23 21:20:12,041 INFO 52898 [egg-security] use xssProtection middleware
2020-04-23 21:20:12,042 INFO 52898 [egg-security] use xframe middleware
2020-04-23 21:20:12,043 INFO 52898 [egg-security] use dta middleware
2020-04-23 21:20:12,043 INFO 52898 [egg-security] compose 5 middlewares into one security middleware
2020-04-23 21:20:12,051 INFO 52898 [egg:core] dump config after load, 5ms
2020-04-23 21:20:12,065 INFO 52898 [egg-redis] client connect success
2020-04-23 21:20:12,070 INFO 52898 [egg-redis] instance[0] status OK, client ready
2020-04-23 21:20:12,072 INFO 52898 [egg-watcher:application] watcher start success
2020-04-23 21:20:12,267 INFO 52898 [egg-mysql] instance[0] status OK, rds currentTime: Thu Apr 23 2020 21:20:12 GMT+0800 (China Standard Time)
2020-04-23 21:20:12,296 INFO 52898 [egg:core] dump config after ready, 7ms
2020-04-23 22:40:56,816 WARN 52898 [ClusterClient:Watcher] follower closed, and try to init it again
2020-04-24 00:21:50,009 WARN 52898 [TCPBase] socket is closed by other side while there were still unhandled data in the socket buffer
2020-04-24 00:21:50,009 WARN 52898 [ClusterClient:Watcher] follower closed, and try to init it again
2020-04-24 00:22:26,166 ERROR 52898 incorrect action: check
2020-04-24 00:30:09,626 WARN 52898 [ClusterClient:Watcher] follower closed, and try to init it again
@@ -43,3 +43,9 @@
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
2020-04-23 21:20:12,301 INFO 52895 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js next time will execute after 25787701ms at 2020-04-24 04:30:00.002
2020-04-23 21:20:12,301 INFO 52895 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js next time will execute after 9587699ms at 2020-04-24 00:00:00.000
2020-04-23 21:20:12,301 INFO 52895 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js next time will execute after 9588699ms at 2020-04-24 00:00:01.000
2020-04-23 21:20:11,786 INFO 52898 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-23 21:20:11,786 INFO 52898 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-23 21:20:11,786 INFO 52898 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
+29
View File
@@ -40,3 +40,32 @@ hostname: 192.168.0.105
2020-04-22 23:39:39,501 ERROR 51873 [-/192.168.0.105/-/12ms GET /socket.io/?room=751675&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoTEiLCJhY2NvdW50IjoiY2FpMTEiLCJ1c2VySWQiOjN9LCJpYXQiOjE1ODc0ODEyOTUsImV4cCI6MTU4NzUwMjg5NX0.04tWzzIEspNyYmtY-EzyesrnpVwD7zx-0zG7K9Rdb2s&EIO=3&transport=websocket] room service tick null
2020-04-22 23:43:45,865 ERROR 51873 game already paling
2020-04-22 23:50:16,775 ERROR 51959 incorrect action: check
2020-04-23 21:24:57,588 ERROR 52898 [-/192.168.0.105/-/24ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 21:25:02,486 ERROR 52898 [-/192.168.0.105/-/5ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 21:25:04,225 ERROR 52898 [-/192.168.0.105/-/6ms GET /socket.io/?room=652114&token=undefined&EIO=3&transport=websocket] room service tick null
2020-04-23 22:40:56,833 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 4284658ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
2020-04-23 22:41:00,428 ERROR 52898 [-/192.168.0.101/-/2ms GET /socket.io/?room=652114&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tOYW1lIjoi6JShMSIsImFjY291bnQiOiJjYWkxMSIsInVzZXJJZCI6M30sImlhdCI6MTU4NzY0ODI1NSwiZXhwIjoxNTg3NjY5ODU1fQ.__TDymI59M3EkIQDEzsjRGaTiZme4EzcbOKvZRjWoQE&EIO=3&transport=websocket] room service tick null
2020-04-24 00:21:50,015 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 6012576ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
2020-04-24 00:22:26,166 ERROR 52898 incorrect action: check
2020-04-24 00:30:09,627 ERROR 52895 nodejs.ClusterClientNoResponseError: client no response in 459401ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side.
at Timeout._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/cluster-client/lib/leader.js:77:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
name: "ClusterClientNoResponseError"
pid: 52895
hostname: 192.168.0.101
+8 -3
View File
@@ -1,8 +1,9 @@
export interface IPlayer {
counter: number;
buyIn: number;
position?: number;
userId: string;
nick_name: string;
nickName: string;
account: string;
socketId: string;
}
@@ -31,8 +32,9 @@ export class Player {
counter: number = 0;
userId: string = '';
socketId: string = '';
nick_name: string = '';
nickName: string = '';
actionSize: number = 0;
actionCommand: string = '';
type: string = EPlayerType.DEFAULT;
evPot: number = Infinity;
pokeStyle: string = '';
@@ -43,7 +45,7 @@ export class Player {
this.position = config.position || 0;
this.userId = config.userId;
this.socketId = config.socketId;
this.nick_name = config.nick_name;
this.nickName = config.nickName;
if (this.position === 0) {
this.type = EPlayerType.DEALER;
}
@@ -77,6 +79,8 @@ export class Player {
if (command !== ECommand.ALL_IN
&& (prevSize > (this.counter + this.actionSize) || raiseSize > this.counter)) {
throw 'player: error action, overflow action size';
} else {
this.actionCommand = command;
}
// BLIND
@@ -132,6 +136,7 @@ export class Player {
}
income(size: number) {
console.log('size', size);
this.counter += size;
}
}
+23 -19
View File
@@ -38,7 +38,7 @@ export class PokerGame {
smallBlind: number;
playerSize: number;
prevSize: number;
prevPot: number;
prevPot: number = 0;
actionTimeOut: Timeout;
allInPlayers: Player[] = [];
currActionAllinPlayer: Player[] = [];
@@ -107,6 +107,7 @@ export class PokerGame {
size = this.currPlayer.node.counter > this.prevSize ?
this.currPlayer.node.counter : this.prevSize;
this.allIn();
console.log('allin: -----------', this.currPlayer);
this.pot += this.currPlayer.node.counter;
// other pot
// only one playeror none playergame is over
@@ -123,8 +124,9 @@ export class PokerGame {
if (command === ECommand.CHECK) {
console.log(this.currPlayer.node.type === EPlayerType.BIG_BLIND
&& this.prevSize === this.smallBlind * 2, 'big blind', this.currPlayer);
size = -1;
// prev player must be check
if (!(this.prevSize === 0 ||
if (!(this.prevSize <= 0 ||
((this.currPlayer.node.type === EPlayerType.BIG_BLIND
|| this.playerSize === 2 && this.currPlayer.node.type === EPlayerType.DEALER)
&& this.prevSize === this.smallBlind * 2))) {
@@ -207,9 +209,11 @@ export class PokerGame {
currAllinPlayerPot += allinPlayer.actionSize;
}
});
console.log('evPot--------------------', this.prevPot, currAllinPlayerPot);
allinPlayer.evPot = this.prevPot + currAllinPlayerPot;
currAllinPlayerPot = 0;
});
console.log('currActionAllinPlayer--------------------', this.allInPlayers, this.currActionAllinPlayer);
this.allInPlayers = [ ...this.allInPlayers, ...this.currActionAllinPlayer ];
}
// action complete clear player actionSize = 0
@@ -220,7 +224,7 @@ export class PokerGame {
// new action ring first action is sb
this.currPlayer = this.playerLink.getNode(1);
this.setSate();
console.log(this.playerSize, 'playerS-------', this.status);
console.log(this.playerSize, 'playerS-------3', this.playerLink);
if (this.status === EGameStatus.GAME_SHOWDOWN || this.playerSize <= 1) {
this.gameOver();
}
@@ -326,12 +330,15 @@ export class PokerGame {
removePlayer(currPlayer: Player) {
let playerLink = this.playerLink.link;
let player: Player;
let player: ILinkNode<Player>;
while (playerLink.next) {
player = playerLink.next.node;
if (currPlayer.userId === player.userId) {
playerLink.next = playerLink.next.next;
player = playerLink.next;
if (currPlayer.userId === player.node.userId) {
const nextNext = playerLink.next.next;
// player.next = null;
playerLink.next = nextNext;
this.playerSize--;
this.playerLink.link = playerLink;
return;
}
playerLink = playerLink.next;
@@ -340,6 +347,8 @@ export class PokerGame {
getWinner() {
if (this.allInPlayers.length === 0 && this.playerSize === 1) {
console.log('only one player');
this.status = EGameStatus.GAME_OVER;
this.winner.push([ this.currPlayer.node ]);
return;
}
@@ -347,12 +356,17 @@ export class PokerGame {
this.sendCard();
this.setSate();
}
this.status = EGameStatus.GAME_OVER;
this.getPlayerPokeStyle();
const getOtherWinner = (withoutPlayers: Player[]) => {
// all player allin, winner can't get all pot
const allPlayer = this.getPlayers('all', withoutPlayers);
// withoutPlayer is allPlayer
if (allPlayer.length === 0) {
return;
}
const maxLastPlayer = this.getMaxPlayers(allPlayer);
this.winner.push(maxLastPlayer);
if (this.getLeftoverPot() > 0) {
@@ -360,17 +374,6 @@ export class PokerGame {
}
};
getOtherWinner([]);
// // compare allin player and last player
// const allPlayers: Player [] = this.getPlayers()
// const maxPlayers = this.getMaxPlayers(allPlayers);
// this.winner.push(maxPlayers);
// // max player can't winner all pot
// const hasSecondWinner = maxPlayers[0].evPot < this.pot;
// // all of winner is all in, must get max curr player
// if (hasSecondWinner) {
// // all player allin, winner can't get all pot
// getOtherWinner(maxPlayers);
// }
}
getPlayerPokeStyle() {
@@ -424,7 +427,8 @@ export class PokerGame {
prevEvPot = this.winner[key - 1][0].evPot;
}
winnerList.forEach(winner => {
winner.income((winner.evPot - prevEvPot) / winnerList.length);
const pot = winner.evPot === Infinity ? this.pot : winner.evPot;
winner.income((pot - prevEvPot) / winnerList.length);
});
});
}
+51 -61
View File
@@ -27,31 +27,52 @@ class GameController extends BaseSocketController {
smallBlind: 1,
updateCommonCard: () => {
// game over
if (roomInfo.game?.status !== 6) {
roomInfo.game?.startActionRound();
roomInfo.game?.sendCard();
} else {
console.log('game over-------------');
console.log(roomInfo.game.commonCard);
console.log(roomInfo.game.pot);
console.log(roomInfo.game.getPlayers());
console.log(roomInfo.game.winner);
if (roomInfo.game) {
if (roomInfo.game.status < 6) {
roomInfo.game.startActionRound();
roomInfo.game.sendCard();
} else {
roomInfo.game.allPlayer.forEach(gamePlayer => {
const player = roomInfo.players.find(
(p: IPlayer) => p.nickName === gamePlayer.nickName);
if (player) {
player.counter = gamePlayer.counter;
}
});
console.log('game over-------------');
console.log(roomInfo.game.commonCard);
console.log(roomInfo.game.pot);
console.log(roomInfo.players, '=============players');
console.log(roomInfo.game.getPlayers());
console.log(roomInfo.game.winner);
// new game
setTimeout(() => {
if (roomInfo.players.length >= 2) {
const player = roomInfo.players.shift();
if (player) {
roomInfo.players.push(player);
}
roomInfo.game = null;
this.playGame();
}
}, 100000);
}
console.log('send common card', roomInfo.game.status);
this.nsp.adapter.clients([ this.roomNumber ],
(err: any, clients: any) => {
if (roomInfo.game) {
// 更新common card
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'commonCard',
target: 'participator',
data: {
commonCard: roomInfo.game.commonCard,
},
});
}
});
}
console.log('send common card', roomInfo.game?.status);
this.nsp.adapter.clients([ this.roomNumber ],
(err: any, clients: any) => {
if (roomInfo.game) {
// 更新common card
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'commonCard',
target: 'participator',
data: {
commonCard: roomInfo.game.commonCard,
},
});
}
});
},
});
roomInfo.game.play();
@@ -85,13 +106,15 @@ class GameController extends BaseSocketController {
const { payload } = this.ctx.args[0] || {};
const { buyInSize } = payload;
const player = roomInfo.players.find(
(p: IPlayer) => p.nick_name === userInfo.nick_name);
(p: IPlayer) => p.nickName === userInfo.nickName);
console.log(userInfo, 'userInfo------');
if (player) {
player.counter = buyInSize;
player.counter += Number(buyInSize);
player.buyIn += Number(buyInSize);
} else {
const player: IPlayer = {
counter: buyInSize,
counter: Number(buyInSize),
buyIn: Number(buyInSize),
...userInfo,
};
roomInfo.players.push(player);
@@ -117,7 +140,7 @@ class GameController extends BaseSocketController {
const userInfo: IPlayer = await this.getUserInfo();
const roomInfo: IRoomInfo = await this.getRoomInfo();
const player = roomInfo.players.find(
(p: IPlayer) => p.nick_name === userInfo.nick_name);
(p: IPlayer) => p.nickName === userInfo.nickName);
console.log(userInfo, 'userInfo------');
if (player && roomInfo.game) {
const gamePlayer = roomInfo.game.allPlayer.find(
@@ -137,39 +160,6 @@ class GameController extends BaseSocketController {
}
}
async updateGameInfo() {
const roomInfo = await this.getRoomInfo();
this.nsp.adapter.clients([ this.roomNumber ], (err: any, clients: any) => {
if (roomInfo.game) {
roomInfo.players.forEach(p => {
const currPlayer = roomInfo.game &&
roomInfo.game.allPlayer.find(player => player.userId === p.userId);
p.counter = currPlayer && currPlayer.counter || 0;
});
const gameInfo = {
players: roomInfo.game.allPlayer.map(p => Object.assign({}, {
counter: p.counter,
actionSize: p.actionSize,
nick_name: p.nick_name,
type: p.type,
}, {})),
pot: roomInfo.game.pot,
prevSize: roomInfo.game.prevSize,
currPlayer: {
userId: roomInfo.game.currPlayer.node.userId,
},
};
// 广播信息
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'gameInfo',
target: 'participator',
data: gameInfo,
});
}
});
}
async action() {
try {
const { payload } = this.message;
+19 -26
View File
@@ -32,6 +32,12 @@ export default function join(): any {
try {
const hasRoom = nsp.gameRooms.find((r: IGameRoom) => r.number === room);
const { user } = await app.jwt.verify(token);
const player = {
...user,
socketId: id,
counter: 0,
buyIn: 0,
};
let gameRoom: IGameRoom = {
number: room,
roomInfo: {
@@ -42,45 +48,32 @@ export default function join(): any {
if (!hasRoom) {
nsp.gameRooms.push(gameRoom);
gameRoom.roomInfo = {
players: [{
...user,
socketId: id,
counter: 0,
}],
players: [ player ],
game: null,
};
} else {
gameRoom = nsp.gameRooms.find((r: IGameRoom) => r.number === room);
const player = gameRoom.roomInfo.players.find((p: IPlayer) => p.account === user.account);
if (!player) {
const player = {
...user,
socketId: id,
counter: 0,
};
const findPlayer = gameRoom.roomInfo.players.find((p: IPlayer) => p.account === user.account);
if (!findPlayer) {
gameRoom.roomInfo.players.push(player);
} else {
player.socketId = id;
findPlayer.socketId = id;
// in the game, update hand cards
const gamePlayer = gameRoom.roomInfo.game?.allPlayer.find(p => user.userId === p.userId);
if (gamePlayer) {
const msg = ctx.helper.parseMsg('handCard', {
handCard: gamePlayer.getHandCard(),
}, { client: id });
socket.emit(id, msg);
}
}
}
socket.join(room);
socket.emit(id, ctx.helper.parseMsg('userInfo', user));
// console.log('players', JSON.stringify(gameRoom.roomInfo.players));
updatePlayer(room, `User(${user.nick_name}) joined.`, 'join', nsp);
updatePlayer(room, `User(${user.nickName}) joined.`, 'join', nsp);
updatePlayer(room, gameRoom.roomInfo.players, 'players', nsp);
// in the game, update hand cards
const player = gameRoom.roomInfo.players.find((p: IPlayer) => p.nick_name === user.nick_name);
if (player && gameRoom.roomInfo.game) {
const gamePlayer = gameRoom.roomInfo.game.allPlayer.find(p => player.socketId === p.socketId);
if (gamePlayer) {
const msg = ctx.helper.parseMsg('handCard', {
handCard: gamePlayer.getHandCard(),
}, { client: player.socketId });
// console.log(msg, 'join: game msg---------2222222');
socket.emit(id, msg);
}
}
await next();
} catch (e) {
throw e;
+34
View File
@@ -24,4 +24,38 @@ export default class BaseSocketController extends Controller {
const roomInfo = this.gameRooms.find((gr: IGameRoom) => gr.number === room);
return roomInfo.roomInfo;
}
async updateGameInfo() {
const roomInfo = await this.getRoomInfo();
this.nsp.adapter.clients([ this.roomNumber ], (err: any, clients: any) => {
if (roomInfo.game) {
roomInfo.players.forEach(p => {
const currPlayer = roomInfo.game &&
roomInfo.game.allPlayer.find(player => player.userId === p.userId);
p.counter = currPlayer && currPlayer.counter || 0;
});
const gameInfo = {
players: roomInfo.game.allPlayer.map(p => Object.assign({}, {
counter: p.counter,
actionSize: p.actionSize,
nickName: p.nickName,
type: p.type,
userId: p.userId,
}, {})),
pot: roomInfo.game.pot,
prevSize: roomInfo.game.prevSize,
currPlayer: {
userId: roomInfo.game.currPlayer.node.userId,
},
};
// 广播信息
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'gameInfo',
target: 'participator',
data: gameInfo,
});
}
});
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ export class AccountService extends BaseService implements IAccountService {
const { nick_name, account, id } = await this.user.findByAccount(userAccount);
const token = this.jwt.sign({
user: {
nick_name,
nickName: nick_name,
account,
userId: id,
},
+143 -3
View File
@@ -8,16 +8,18 @@ describe('test/app/core/pokerGame.test.ts', () => {
{
userId: '1',
counter: 200,
nick_name: '1',
nickName: '1',
account: '1',
socketId: '1',
buyIn: 0,
},
{
userId: '2',
counter: 200,
nick_name: '2',
counter: 400,
nickName: '2',
account: '2',
socketId: '2',
buyIn: 0,
},
// {
// userId: '3',
@@ -84,6 +86,144 @@ describe('test/app/core/pokerGame.test.ts', () => {
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
it('raise check ', async () => {
const game = new PokerGame({
smallBlind: 1,
users,
updateCommonCard: () => {
if (game.status < 6) {
game.startActionRound();
game.sendCard();
}
},
});
game.play();
game.action('raise:9');
game.action('call');
game.action('check');
game.action('check');
// game.action('raise:10');
console.log(game.commonCard);
console.log(game.pot);
console.log(game.getPlayers());
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
it('raise call raise fold ', async () => {
const game = new PokerGame({
smallBlind: 1,
users,
updateCommonCard: () => {
if (game.status < 6) {
game.startActionRound();
game.sendCard();
}
},
});
game.play();
game.action('raise:9');
game.action('call');
// game.action('check');
// game.action('check');
game.action('raise:90');
game.action('fold');
// game.action('raise:10');
console.log(game.commonCard);
console.log(game.pot);
console.log(game.getPlayers());
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
it('show down', async () => {
const game = new PokerGame({
smallBlind: 1,
users,
updateCommonCard: () => {
if (game.status < 6) {
game.startActionRound();
game.sendCard();
}
},
});
game.play();
// pre flop
game.action('raise:9');
game.action('call');
// flop
game.action('raise:90');
game.action('call');
// turn
game.action('check');
game.action('check');
// river
game.action('raise:90');
game.action('call');
// show down
// game.action('raise:10');
console.log(game.commonCard);
console.log(game.pot);
console.log(game.getPlayers());
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
it('all player allin for pre flop', async () => {
const game = new PokerGame({
smallBlind: 1,
users,
updateCommonCard: () => {
if (game.status < 6) {
game.startActionRound();
game.sendCard();
}
},
});
game.play();
// pre flop
game.action('raise:9');
game.action('allin');
game.action('allin');
// game over
// game.action('raise:10');
console.log(game.commonCard);
console.log(game.pot);
console.log(game.getPlayers());
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
it('one player allin', async () => {
const game = new PokerGame({
smallBlind: 1,
users,
updateCommonCard: () => {
if (game.status < 6) {
game.startActionRound();
game.sendCard();
}
},
});
game.play();
// pre flop
game.action('raise:9');
game.action('call');
game.action('raise: 9');
game.action('raise: 18');
game.action('raise: 200');
game.action('allin');
// game over
// game.action('raise:10');
console.log(game.commonCard);
console.log(game.pot);
console.log(game.getPlayers());
console.log(game.winner);
// console.log(game.winner[0][0], game.commonCard);
});
// flop
// turn
// river
+13 -6
View File
@@ -3,14 +3,21 @@ import { Player } from '../../src/app/core/Player';
describe('test/utils/link.test.ts', () => {
it('link', async () => {
const person1 = new Player({ counter: 1, position: 1, userId: '1', socketId: '', account: '', nick_name: '' });
const person2 = new Player({ counter: 2, position: 2, userId: '2', socketId: '', account: '', nick_name: '' });
const person3 = new Player({ counter: 2, position: 3, userId: '3', socketId: '', account: '', nick_name: '' });
const person4 = new Player({ counter: 2, position: 4, userId: '4', socketId: '', account: '', nick_name: '' });
const person1 = new Player({
buyIn: 0,
counter: 1, position: 1, userId: '1', socketId: '', account: '', nickName: '' });
const person2 = new Player({
buyIn: 0,
counter: 2, position: 2, userId: '2', socketId: '', account: '', nickName: '' });
const person3 = new Player({
buyIn: 0,
counter: 2, position: 3, userId: '3', socketId: '', account: '', nickName: '' });
const person4 = new Player({
buyIn: 0,
counter: 2, position: 4, userId: '4', socketId: '', account: '', nickName: '' });
// const person5 = new Player({ counter: 2, position: 5, userId: '5' });
const link = new Link<Player>([ person1, person2, person3, person4 ], false);
// console.log(link.getNode(0), 'link--------')
console.log(link);
console.log(link.removeNode(0));
});
});