mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-09 20:12:34 +02:00
Merge pull request #1313 from lnbits/gertytweak
Fix/gerty mempool caching timestamp bug (again)
This commit is contained in:
@@ -117,19 +117,19 @@ async def get_mempool_info(endPoint: str, gerty) -> dict:
|
|||||||
mempool_id,
|
mempool_id,
|
||||||
json.dumps(response.json()),
|
json.dumps(response.json()),
|
||||||
endPoint,
|
endPoint,
|
||||||
db.timestamp_now,
|
time.time(),
|
||||||
gerty.mempool_endpoint,
|
gerty.mempool_endpoint,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return response.json()
|
return response.json()
|
||||||
if int(time.time()) - row.time > 20:
|
if float(time.time()) - row.time > 20:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
response = await client.get(gerty.mempool_endpoint + url)
|
response = await client.get(gerty.mempool_endpoint + url)
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"UPDATE gerty.mempool SET data = ?, time = ? WHERE endpoint = ? AND mempool_endpoint = ?",
|
"UPDATE gerty.mempool SET data = ?, time = ? WHERE endpoint = ? AND mempool_endpoint = ?",
|
||||||
(
|
(
|
||||||
json.dumps(response.json()),
|
json.dumps(response.json()),
|
||||||
db.timestamp_now,
|
time.time(),
|
||||||
endPoint,
|
endPoint,
|
||||||
gerty.mempool_endpoint,
|
gerty.mempool_endpoint,
|
||||||
),
|
),
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
async def m001_initial(db):
|
async def m001_initial(db):
|
||||||
"""
|
"""
|
||||||
Initial Gertys table.
|
Initial Gertys table.
|
||||||
@@ -57,3 +60,46 @@ async def m005_add_gerty_model_col(db):
|
|||||||
support for Gerty model col
|
support for Gerty model col
|
||||||
"""
|
"""
|
||||||
await db.execute("ALTER TABLE gerty.gertys ADD COLUMN urls TEXT;")
|
await db.execute("ALTER TABLE gerty.gertys ADD COLUMN urls TEXT;")
|
||||||
|
|
||||||
|
|
||||||
|
async def m006_add_gerty_model_col(db):
|
||||||
|
"""
|
||||||
|
Add UUID ID's to links and migrates existing data
|
||||||
|
"""
|
||||||
|
await db.execute("ALTER TABLE gerty.mempool RENAME TO mempool_old")
|
||||||
|
await db.execute(
|
||||||
|
f"""
|
||||||
|
CREATE TABLE gerty.mempool (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
mempool_endpoint TEXT NOT NULL,
|
||||||
|
endpoint TEXT NOT NULL,
|
||||||
|
data TEXT NOT NULL,
|
||||||
|
time FLOAT
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
for row in [
|
||||||
|
list(row) for row in await db.fetchall("SELECT * FROM gerty.mempool_old")
|
||||||
|
]:
|
||||||
|
await db.execute(
|
||||||
|
"""
|
||||||
|
INSERT INTO gerty.mempool (
|
||||||
|
id,
|
||||||
|
mempool_endpoint,
|
||||||
|
endpoint,
|
||||||
|
data,
|
||||||
|
time
|
||||||
|
)
|
||||||
|
VALUES (?, ?, ?, ?, ?)
|
||||||
|
""",
|
||||||
|
(
|
||||||
|
row[0],
|
||||||
|
row[1],
|
||||||
|
row[2],
|
||||||
|
row[3],
|
||||||
|
time.time(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
await db.execute("DROP TABLE gerty.mempool_old")
|
||||||
|
@@ -6,7 +6,7 @@ gertyname }}{% endraw %}{% endblock %}{% block page %} {% raw %}
|
|||||||
v-if="fun_exchange_market_rate || fun_satoshi_quotes"
|
v-if="fun_exchange_market_rate || fun_satoshi_quotes"
|
||||||
>
|
>
|
||||||
<q-card
|
<q-card
|
||||||
v-if="fun_exchange_market_rate"
|
v-if="fun_exchange_market_rate[0]"
|
||||||
unelevated
|
unelevated
|
||||||
class="q-pa-sm"
|
class="q-pa-sm"
|
||||||
style="background: none !important"
|
style="background: none !important"
|
||||||
|
Reference in New Issue
Block a user