Skip to content

Commit df80dae

Browse files
fixes after review
1 parent 8e84bfb commit df80dae

10 files changed

+186
-133
lines changed

api/openapi.json

+18-13
Original file line numberDiff line numberDiff line change
@@ -3052,18 +3052,6 @@
30523052
],
30533053
"type": "object"
30543054
},
3055-
"IndexingLatency": {
3056-
"properties": {
3057-
"indexing_latency": {
3058-
"example": 100,
3059-
"type": "integer"
3060-
}
3061-
},
3062-
"required": [
3063-
"indexing_latency"
3064-
],
3065-
"type": "object"
3066-
},
30673055
"InitStateRaw": {
30683056
"properties": {
30693057
"file_hash": {
@@ -4428,6 +4416,23 @@
44284416
],
44294417
"type": "object"
44304418
},
4419+
"ServiceStatus": {
4420+
"properties": {
4421+
"indexing_latency": {
4422+
"example": 100,
4423+
"type": "integer"
4424+
},
4425+
"rest_online": {
4426+
"default": true,
4427+
"type": "boolean"
4428+
}
4429+
},
4430+
"required": [
4431+
"indexing_latency",
4432+
"rest_online"
4433+
],
4434+
"type": "object"
4435+
},
44314436
"SizeLimitsConfig": {
44324437
"properties": {
44334438
"max_acc_state_bits": {
@@ -8961,7 +8966,7 @@
89618966
"content": {
89628967
"application/json": {
89638968
"schema": {
8964-
"$ref": "#/components/schemas/IndexingLatency"
8969+
"$ref": "#/components/schemas/ServiceStatus"
89658970
}
89668971
}
89678972
},

api/openapi.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ paths:
2323
content:
2424
application/json:
2525
schema:
26-
$ref: '#/components/schemas/IndexingLatency'
26+
$ref: '#/components/schemas/ServiceStatus'
2727
'default':
2828
$ref: '#/components/responses/Error'
2929
/v2/blockchain/blocks/{block_id}:
@@ -2997,11 +2997,15 @@ components:
29972997
$ref: '#/components/schemas/BlockCurrencyCollection'
29982998
minted:
29992999
$ref: '#/components/schemas/BlockCurrencyCollection'
3000-
IndexingLatency:
3000+
ServiceStatus:
30013001
type: object
30023002
required:
30033003
- indexing_latency
3004+
- rest_online
30043005
properties:
3006+
rest_online:
3007+
type: boolean
3008+
default: true
30053009
indexing_latency:
30063010
type: integer
30073011
example: 100

pkg/api/blockchain_handlers.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ import (
2121
"github.com/tonkeeper/tongo/ton"
2222
)
2323

24-
func (h *Handler) ReduceIndexingLatency(ctx context.Context) (*oas.IndexingLatency, error) {
24+
func (h *Handler) ReduceIndexingLatency(ctx context.Context) (*oas.ServiceStatus, error) {
2525
indexingLatency, err := h.storage.ReduceIndexingLatency(ctx)
2626
if errors.Is(err, core.ErrEntityNotFound) {
2727
return nil, toError(http.StatusInternalServerError, err)
2828
}
29-
return &oas.IndexingLatency{IndexingLatency: int(indexingLatency)}, nil
29+
var restOnline = true
30+
if err != nil {
31+
restOnline = false
32+
}
33+
return &oas.ServiceStatus{
34+
IndexingLatency: int(indexingLatency),
35+
RestOnline: restOnline,
36+
}, nil
3037
}
3138

3239
func (h *Handler) GetBlockchainBlock(ctx context.Context, params oas.GetBlockchainBlockParams) (*oas.BlockchainBlock, error) {

pkg/oas/oas_defaults_gen.go

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/oas/oas_handlers_gen.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/oas/oas_json_gen.go

+114-96
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/oas/oas_response_encoders_gen.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)