Skip to content

Commit 37d7e1e

Browse files
authored
Add logIndex to triggerCaching. (#1008)
* Add logIndex to triggerCaching. * Add chainId to swagger docs. * Fix triggerCaching documentation for Swagger. * Fixes mixed content issue in swagger.
1 parent 37d47ab commit 37d7e1e

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

aquarius/app/assets.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import copy
66
import elasticsearch
77
from flask import Blueprint, jsonify, request
8-
from datetime import datetime, timedelta
8+
from datetime import timedelta
99
import json
1010
import logging
1111
import os
@@ -17,7 +17,6 @@
1717
get_signature_vrs,
1818
)
1919
from aquarius.ddo_checker.shacl_checker import validate_dict
20-
from aquarius.events.util import setup_web3
2120
from aquarius.log import setup_logging
2221
from aquarius.myapp import app
2322
from aquarius.events.purgatory import Purgatory
@@ -389,12 +388,26 @@ def trigger_caching():
389388
consumes:
390389
- application/json
391390
parameters:
392-
- name: transactionId
391+
- in: body
392+
name: body
393393
required: true
394-
description: transaction id containing MetadataCreated or MetadataUpdated event
395-
- name: logIndex
396-
required: false
397-
description: zero-based index in log if transaction contains more events
394+
description: JSON object containing transaction details
395+
schema:
396+
type: object
397+
properties:
398+
transactionId:
399+
type: string
400+
description: transaction id containing MetadataCreated or MetadataUpdated event
401+
example: "0xaabbccdd"
402+
chainId:
403+
type: int
404+
description: chain Id id of MetadataCreated or MetadataUpdated event
405+
example: 8996
406+
logIndex:
407+
type: int
408+
required: false
409+
description: log index for the event in the transaction
410+
example: 8996
398411
responses:
399412
200:
400413
description: successful operation.
@@ -414,8 +427,6 @@ def trigger_caching():
414427
)
415428
log_index = int(data.get("logIndex", 0))
416429

417-
web3 = setup_web3()
418-
419430
es_instance = ElasticsearchInstance()
420431
retries_db_index = f"{es_instance.db_index}_retries"
421432
purgatory = (
@@ -428,7 +439,7 @@ def trigger_caching():
428439
es_instance, retries_db_index, purgatory, chain_id, None
429440
)
430441
retry_mechanism.retry_interval = timedelta(seconds=1)
431-
retry_mechanism.add_tx_to_retry_queue(tx_id)
442+
retry_mechanism.add_tx_to_retry_queue(tx_id, log_index)
432443
response = app.response_class(
433444
response="Queued",
434445
status=200,

aquarius/run.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def spec():
8080
# Call factory function to create our blueprint
8181
swaggerui_blueprint = get_swaggerui_blueprint(
8282
BaseURLs.SWAGGER_URL,
83-
aquarius_url + "/spec",
83+
"/spec",
8484
config={"app_name": "Test application"}, # Swagger UI config overrides
8585
)
8686

@@ -112,7 +112,9 @@ def force_set_block(chain_id, block_number):
112112

113113
def get_status():
114114
db_url = (
115-
os.getenv("DB_HOSTNAME", "https://localhost") + ":" + os.getenv("DB_PORT", 9200)
115+
os.getenv("DB_HOSTNAME", "https://localhost")
116+
+ ":"
117+
+ os.getenv("DB_PORT", "9200")
116118
)
117119
if Elasticsearch(db_url).ping():
118120
return "Elasticsearch connected", 200

0 commit comments

Comments
 (0)