refactor: move JOB_FETCH_BITCOIN_PRICE constant to worker.py
Unlike JOB_RANDOM_NUMBER which is used for external job enqueueing, JOB_FETCH_BITCOIN_PRICE is only used internally by the scheduler. Move it to worker.py to clarify it's not part of the public job API.
This commit is contained in:
parent
a5488fd20b
commit
13d2e4adeb
2 changed files with 4 additions and 2 deletions
|
|
@ -10,7 +10,6 @@ from database import ASYNCPG_DATABASE_URL
|
||||||
|
|
||||||
# Job type constants
|
# Job type constants
|
||||||
JOB_RANDOM_NUMBER = "random_number"
|
JOB_RANDOM_NUMBER = "random_number"
|
||||||
JOB_FETCH_BITCOIN_PRICE = "fetch_bitcoin_price"
|
|
||||||
|
|
||||||
# Connection pool for job enqueueing (lazy initialized)
|
# Connection pool for job enqueueing (lazy initialized)
|
||||||
_pool: asyncpg.Pool | None = None
|
_pool: asyncpg.Pool | None = None
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,12 @@ from pgqueuer.models import Schedule
|
||||||
from pgqueuer.queries import Queries
|
from pgqueuer.queries import Queries
|
||||||
|
|
||||||
from database import ASYNCPG_DATABASE_URL
|
from database import ASYNCPG_DATABASE_URL
|
||||||
from jobs import JOB_FETCH_BITCOIN_PRICE, JOB_RANDOM_NUMBER
|
from jobs import JOB_RANDOM_NUMBER
|
||||||
from price_fetcher import PAIR_BTC_EUR, SOURCE_BITFINEX, fetch_btc_eur_price
|
from price_fetcher import PAIR_BTC_EUR, SOURCE_BITFINEX, fetch_btc_eur_price
|
||||||
|
|
||||||
|
# Scheduled job type (internal to worker, not enqueued externally)
|
||||||
|
JOB_FETCH_BITCOIN_PRICE = "fetch_bitcoin_price"
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue