mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 21:02:31 +02:00
swapped timestamp type for float, fixes issue
This commit is contained in:
@@ -122,7 +122,7 @@ async def get_mempool_info(endPoint: str, gerty) -> dict:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
return response.json()
|
return response.json()
|
||||||
if int(time.time()) - int(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(
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
async def m001_initial(db):
|
async def m001_initial(db):
|
||||||
"""
|
"""
|
||||||
Initial Gertys table.
|
Initial Gertys table.
|
||||||
@@ -57,3 +59,52 @@ 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):
|
||||||
|
"""
|
||||||
|
support for Gerty model col
|
||||||
|
"""
|
||||||
|
await db.execute("ALTER TABLE gerty.mempool RENAME TO mempool_old;")
|
||||||
|
await db.execute("ALTER TABLE gerty.mempool ADD COLUMN time FLOAT;")
|
||||||
|
|
||||||
|
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")
|
Reference in New Issue
Block a user