Skip to content

Commit

Permalink
Merge pull request #31 from mysteriumnetwork/fix-quality-requests
Browse files Browse the repository at this point in the history
Execute quality requests in parallel
  • Loading branch information
vkuznecovas authored Aug 11, 2021
2 parents 784ae60 + 5b4ff24 commit edbaf71
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 85 deletions.
58 changes: 49 additions & 9 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/proposal.PingResponse"
"$ref": "#/definitions/health.PingResponse"
}
}
}
Expand Down Expand Up @@ -222,9 +222,51 @@ var doc = `{
}
}
}
},
"/status": {
"get": {
"description": "Status",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/health.StatusResponse"
}
}
}
}
}
},
"definitions": {
"health.PingResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"health.StatusResponse": {
"type": "object",
"properties": {
"cache_ok": {
"type": "boolean"
},
"db_ok": {
"type": "boolean"
}
}
},
"pricing.Config": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -331,14 +373,6 @@ var doc = `{
}
}
},
"proposal.PingResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"v3.AccessPolicy": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -445,6 +479,12 @@ var doc = `{
},
"service_type": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
Expand Down
58 changes: 49 additions & 9 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/proposal.PingResponse"
"$ref": "#/definitions/health.PingResponse"
}
}
}
Expand Down Expand Up @@ -206,9 +206,51 @@
}
}
}
},
"/status": {
"get": {
"description": "Status",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/health.StatusResponse"
}
}
}
}
}
},
"definitions": {
"health.PingResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"health.StatusResponse": {
"type": "object",
"properties": {
"cache_ok": {
"type": "boolean"
},
"db_ok": {
"type": "boolean"
}
}
},
"pricing.Config": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -315,14 +357,6 @@
}
}
},
"proposal.PingResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"v3.AccessPolicy": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -429,6 +463,12 @@
},
"service_type": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
Expand Down
38 changes: 32 additions & 6 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
basePath: /api/v3
definitions:
health.PingResponse:
properties:
message:
type: string
type: object
health.StatusResponse:
properties:
cache_ok:
type: boolean
db_ok:
type: boolean
type: object
pricing.Config:
properties:
base_prices:
Expand Down Expand Up @@ -68,11 +80,6 @@ definitions:
price_per_hour_usd:
type: number
type: object
proposal.PingResponse:
properties:
message:
type: string
type: object
v3.AccessPolicy:
properties:
id:
Expand Down Expand Up @@ -143,6 +150,10 @@ definitions:
$ref: '#/definitions/v3.Quality'
service_type:
type: string
tags:
items:
type: string
type: array
type: object
v3.Quality:
properties:
Expand Down Expand Up @@ -173,7 +184,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/proposal.PingResponse'
$ref: '#/definitions/health.PingResponse'
summary: Ping
tags:
- system
Expand Down Expand Up @@ -294,4 +305,19 @@ paths:
$ref: '#/definitions/v3.Metadata'
type: array
summary: List proposals' metadata.
/status:
get:
consumes:
- application/json
description: Status
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/health.StatusResponse'
summary: Status
tags:
- system
swagger: "2.0"
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.16
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/allegro/bigcache v1.2.1
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/dghubble/sling v1.3.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fatih/color v1.10.0
Expand Down Expand Up @@ -35,7 +36,8 @@ require (
github.com/swaggo/swag v1.7.0
github.com/ugorji/go v1.2.4 // indirect
go.uber.org/automaxprocs v1.4.0 // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/tools v0.1.3 // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
Expand Down Expand Up @@ -1109,6 +1111,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6O
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1203,6 +1207,8 @@ golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b h1:qh4f65QIVFjq9eBURLEYWqaEX
golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1213,6 +1219,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1289,6 +1297,8 @@ golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
Loading

0 comments on commit edbaf71

Please sign in to comment.