Compare commits
2 Commits
7ae7349550
...
58ff276e10
Author | SHA1 | Date | |
---|---|---|---|
58ff276e10 | |||
11e5f17b20 |
@ -60,6 +60,8 @@ const localApps = [
|
||||
instances: instancesNum,
|
||||
// 传递给脚本的参数
|
||||
args: '-serverType msg',
|
||||
//允许强制gc
|
||||
node_args: '--expose-gc',
|
||||
// 是否启用监控模式,默认是false。如果设置成true,当应用程序变动时,pm2会自动重载。这里也可以设置你要监控的文件。
|
||||
watch: false,
|
||||
// 不用监听的文件
|
||||
@ -86,6 +88,8 @@ const crossApps = [
|
||||
cwd: './',
|
||||
// 传递给脚本的参数
|
||||
args: '-serverType cross',
|
||||
//允许强制gc
|
||||
node_args: '--expose-gc',
|
||||
// 是否启用监控模式,默认是false。如果设置成true,当应用程序变动时,pm2会自动重载。这里也可以设置你要监控的文件。
|
||||
watch: false,
|
||||
// 不用监听的文件
|
||||
|
31
package-lock.json
generated
31
package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"axios": "^1.4.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"express": "^4.18.2",
|
||||
"heapdump": "^0.3.15",
|
||||
"ioredis": "^5.3.2",
|
||||
"json5": "^2.2.3",
|
||||
"mathjs": "^11.4.0",
|
||||
@ -2545,6 +2546,18 @@
|
||||
"he": "bin/he"
|
||||
}
|
||||
},
|
||||
"node_modules/heapdump": {
|
||||
"version": "0.3.15",
|
||||
"resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.15.tgz",
|
||||
"integrity": "sha512-n8aSFscI9r3gfhOcAECAtXFaQ1uy4QSke6bnaL+iymYZ/dWs9cqDqHM+rALfsHUwukUbxsdlECZ0pKmJdQ/4OA==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"nan": "^2.13.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/http-basic": {
|
||||
"version": "8.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/http-basic/-/http-basic-8.1.3.tgz",
|
||||
@ -3199,6 +3212,11 @@
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/nan": {
|
||||
"version": "2.18.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
|
||||
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.1.tgz",
|
||||
@ -6645,6 +6663,14 @@
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||
"dev": true
|
||||
},
|
||||
"heapdump": {
|
||||
"version": "0.3.15",
|
||||
"resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.15.tgz",
|
||||
"integrity": "sha512-n8aSFscI9r3gfhOcAECAtXFaQ1uy4QSke6bnaL+iymYZ/dWs9cqDqHM+rALfsHUwukUbxsdlECZ0pKmJdQ/4OA==",
|
||||
"requires": {
|
||||
"nan": "^2.13.2"
|
||||
}
|
||||
},
|
||||
"http-basic": {
|
||||
"version": "8.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/http-basic/-/http-basic-8.1.3.tgz",
|
||||
@ -7163,6 +7189,11 @@
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.18.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
|
||||
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.1.tgz",
|
||||
|
@ -37,6 +37,7 @@
|
||||
"axios": "^1.4.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"express": "^4.18.2",
|
||||
"heapdump": "^0.3.15",
|
||||
"ioredis": "^5.3.2",
|
||||
"json5": "^2.2.3",
|
||||
"mathjs": "^11.4.0",
|
||||
|
23
src/api_o2s/games/Apiheapdump.ts
Normal file
23
src/api_o2s/games/Apiheapdump.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { Reqheapdump, Resheapdump } from "../../monopoly/protocols/games/Ptlheapdump";
|
||||
var heapdump = require('heapdump');
|
||||
|
||||
export default async function (call: ApiCall<Reqheapdump, Resheapdump>) {
|
||||
|
||||
if(call.req.act == "heapdump"){
|
||||
let name = Date.now() + '.heapsnapshot'
|
||||
heapdump.writeSnapshot(name);
|
||||
call.succ({
|
||||
code:200,
|
||||
data:name
|
||||
})
|
||||
}
|
||||
|
||||
if(call.req.act == "gc"){
|
||||
global.gc();
|
||||
call.succ({
|
||||
code:200,
|
||||
data:"gc..."
|
||||
})
|
||||
}
|
||||
}
|
18
src/monopoly/protocols/games/Ptlheapdump.ts
Normal file
18
src/monopoly/protocols/games/Ptlheapdump.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { StringTypeSchema } from "tsbuffer-schema";
|
||||
|
||||
/**
|
||||
* 区服初始化
|
||||
*/
|
||||
export type Reqheapdump = {
|
||||
act:string,
|
||||
data:any
|
||||
};
|
||||
|
||||
|
||||
export type Resheapdump = {
|
||||
/**
|
||||
* 如果发送成功 将返回
|
||||
*/
|
||||
code: number
|
||||
data: any;
|
||||
};
|
@ -1,6 +1,7 @@
|
||||
import { ServiceProto } from 'tsrpc-proto';
|
||||
import { Reqsendemail, Ressendemail } from './email/Ptlsendemail';
|
||||
import { Reqdeploy, Resdeploy } from './games/Ptldeploy';
|
||||
import { Reqheapdump, Resheapdump } from './games/Ptlheapdump';
|
||||
import { Reqmetrics, Resmetrics } from './games/Ptlmetrics';
|
||||
import { Reqnotification, Resnotification } from './games/Ptlnotification';
|
||||
import { Reqopen, Resopen } from './games/Ptlopen';
|
||||
@ -31,6 +32,10 @@ export interface ServiceType {
|
||||
req: Reqdeploy,
|
||||
res: Resdeploy
|
||||
},
|
||||
"games/heapdump": {
|
||||
req: Reqheapdump,
|
||||
res: Resheapdump
|
||||
},
|
||||
"games/metrics": {
|
||||
req: Reqmetrics,
|
||||
res: Resmetrics
|
||||
@ -127,96 +132,101 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "games/metrics",
|
||||
"name": "games/heapdump",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "games/notification",
|
||||
"name": "games/metrics",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "games/open",
|
||||
"name": "games/notification",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "games/ranking",
|
||||
"name": "games/open",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "gift/popup",
|
||||
"name": "games/ranking",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "gm/Pay",
|
||||
"name": "gift/popup",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "gm/SendPrize",
|
||||
"name": "gm/Pay",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "hdinfo/details",
|
||||
"name": "gm/SendPrize",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "AddHuoDong",
|
||||
"name": "hdinfo/details",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"name": "CatAllhd",
|
||||
"name": "AddHuoDong",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "DelHuoDong",
|
||||
"name": "CatAllhd",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "Email",
|
||||
"name": "DelHuoDong",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"name": "GetLog",
|
||||
"name": "Email",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"name": "healthz",
|
||||
"name": "GetLog",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"name": "union/rename",
|
||||
"name": "healthz",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"name": "user/data",
|
||||
"name": "union/rename",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"name": "user/disable",
|
||||
"name": "user/data",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"name": "user/getdata",
|
||||
"name": "user/disable",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"name": "user/getdata",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"name": "user/rename",
|
||||
"type": "api"
|
||||
}
|
||||
@ -367,6 +377,44 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"games/Ptlheapdump/Reqheapdump": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "act",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "data",
|
||||
"type": {
|
||||
"type": "Any"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"games/Ptlheapdump/Resheapdump": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "code",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "data",
|
||||
"type": {
|
||||
"type": "Any"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"games/Ptlmetrics/Reqmetrics": {
|
||||
"type": "Interface"
|
||||
},
|
||||
|
@ -10,7 +10,8 @@ export async function createHttp() {
|
||||
json: true,
|
||||
cors: '*',
|
||||
port: G.config.httpPort,
|
||||
logLevel: G.argv.logModel as LogLevel
|
||||
logLevel: G.argv.logModel as LogLevel,
|
||||
apiTimeout:300000,
|
||||
});
|
||||
setHttp(G.http);
|
||||
await G.http.autoImplementApi(resolve(__dirname, 'api_o2s'), true);
|
||||
|
Loading…
Reference in New Issue
Block a user