fix: use Python datetime for created_at in worker
Consistent with model default which uses datetime.now(UTC) rather than SQL NOW() for created_at field.
This commit is contained in:
parent
b0d5d51a21
commit
de12300593
1 changed files with 3 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import json
|
|||
import logging
|
||||
import random
|
||||
import time
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import asyncpg
|
||||
from pgqueuer import Job, QueueManager, SchedulerManager
|
||||
|
|
@ -116,13 +117,14 @@ async def process_bitcoin_price_job(db_pool: asyncpg.Pool) -> None:
|
|||
"""
|
||||
INSERT INTO price_history
|
||||
(source, pair, price, timestamp, created_at)
|
||||
VALUES ($1, $2, $3, $4, NOW())
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
ON CONFLICT (source, pair, timestamp) DO NOTHING
|
||||
""",
|
||||
SOURCE_BITFINEX,
|
||||
PAIR_BTC_EUR,
|
||||
price,
|
||||
timestamp,
|
||||
datetime.now(UTC),
|
||||
)
|
||||
|
||||
logger.info(f"Fetched BTC/EUR price: €{price:.2f}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue