Skip to content

Commit

Permalink
get uuid给个超时时间
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jul 12, 2022
1 parent 824f23e commit becc5f4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
38 changes: 32 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@types/got": "^9.6.9",
"@types/js-yaml": "^3.12.2",
"@types/lodash": "^4.14.149",
"@types/ms": "^0.7.31",
"@types/node": "^13.5.1",
"@types/verror": "^1.10.5",
"@typescript-eslint/eslint-plugin": "^5.10.1",
Expand All @@ -56,6 +57,7 @@
"lodash": "^4.17.15",
"minecraft-data": "^2.221.0",
"minecraft-protocol": "^1.30.0",
"ms": "^2.1.3",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.16",
"tapable": "^2.2.1",
Expand Down
8 changes: 7 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {Backend} from './backend'
import {Config} from './config'
import {MinecraftData} from './minecraft-data'
import {ProxyServer} from './proxy-server'
import ms = require('ms')

export class Client extends EventEmitter {
public host: string
Expand Down Expand Up @@ -205,7 +206,12 @@ export class Client extends EventEmitter {
} else {
const resp = await got<{id: string; name: string}[]>(
this.config.profileEndpoint,
{method: 'POST', responseType: 'json', body: JSON.stringify([this.username])},
{
method: 'POST',
responseType: 'json',
body: JSON.stringify([this.username]),
timeout: ms('10s'),
},
)
if (resp.body.length > 0) {
this._uuid = resp.body[0].id
Expand Down

0 comments on commit becc5f4

Please sign in to comment.