moved discord specifics into discord bot repo
This commit is contained in:
1 parent
44f8184864
commit
bd46b92724
3 files changed
+6
-35
No files matched your search
@@ -18,14 +18,6 @@ MONGO_DATABASE_NAME = "tpv_woot"
|
|||||||
MONGO_URL = (
|
MONGO_URL = (
|
||||||
"mongodb://tpv:n3%23QI07GnbZCbvGJ@zelda.disqualifier.me:27017/?authSource=tpv_woot"
|
"mongodb://tpv:n3%23QI07GnbZCbvGJ@zelda.disqualifier.me:27017/?authSource=tpv_woot"
|
||||||
)
|
)
|
||||||
ALERTS_COLLECTION_NAME = "alerts"
|
|
||||||
PRODUCTION_BOT_TOKEN = (
|
|
||||||
"MTUyMzEzODU4Mzk5MTU1NDA2OA.GitGwF.FbSuzph3zOVEp1LN0wVkH3tH1q3ckwLGUxD_hM"
|
|
||||||
)
|
|
||||||
DEVELOPMENT_BOT_TOKEN = (
|
|
||||||
"MTUyMzA2NDkyNTc1OTYwMjg1MA.Ge7Vic._u6J1EcM9_yv63UJCAZry8d80PjEfUPhjAnRvU"
|
|
||||||
)
|
|
||||||
PROFIT_API_KEY = "dev-XvIu8S83BJ2N1C9ZCsoLAAav5jan7kj5"
|
|
||||||
LOGGING_LEVEL = "INFO"
|
LOGGING_LEVEL = "INFO"
|
||||||
LOGGERS = [
|
LOGGERS = [
|
||||||
"discord",
|
"discord",
|
||||||
@@ -44,22 +36,6 @@ CLIENT_IDENTIFIERS = ["chrome", "chrome_android", "safari", "safari_ios"]
|
|||||||
CLIENT_TIMEOUT = aiohttp.ClientTimeout(
|
CLIENT_TIMEOUT = aiohttp.ClientTimeout(
|
||||||
total=TIMEOUT_SECONDS, sock_connect=30, sock_read=30
|
total=TIMEOUT_SECONDS, sock_connect=30, sock_read=30
|
||||||
)
|
)
|
||||||
|
|
||||||
FLAG_WEBHOOK_MAP = (
|
|
||||||
("member_pick", "memberPick"),
|
|
||||||
("member_deal", "memberDeal"),
|
|
||||||
)
|
|
||||||
|
|
||||||
BUCKET_WEBHOOK_MAP = {
|
|
||||||
40: "40-49",
|
|
||||||
50: "50-60",
|
|
||||||
60: "60-70",
|
|
||||||
70: "70-80",
|
|
||||||
80: "80-90",
|
|
||||||
90: "90-100",
|
|
||||||
"price_drop": "40-49",
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECTED_TASK_ERRORS = (
|
EXPECTED_TASK_ERRORS = (
|
||||||
RequestsError,
|
RequestsError,
|
||||||
aiohttp.ClientError,
|
aiohttp.ClientError,
|
||||||
|
|||||||
@@ -15,11 +15,7 @@ from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorCollection
|
|||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
from pymongo.errors import BulkWriteError, PyMongoError
|
from pymongo.errors import BulkWriteError, PyMongoError
|
||||||
|
|
||||||
from monitor_utils.constants import (
|
from monitor_utils.constants import MONGO_DATABASE_NAME, MONGO_URL
|
||||||
ALERTS_COLLECTION_NAME,
|
|
||||||
MONGO_DATABASE_NAME,
|
|
||||||
MONGO_URL,
|
|
||||||
)
|
|
||||||
from monitor_utils.models import Product
|
from monitor_utils.models import Product
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
@@ -145,7 +141,9 @@ async def add_products_to_database(
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
async def write_alert_ops(alert_ops: list[UpdateOne]):
|
async def write_alert_ops(
|
||||||
|
alert_ops: list[UpdateOne], alerts_collection_name: AsyncIOMotorCollection
|
||||||
|
):
|
||||||
"""Write alert upserts, swallowing duplicate-key races.
|
"""Write alert upserts, swallowing duplicate-key races.
|
||||||
|
|
||||||
Concurrent tasks upserting an alert for the same product can both pass
|
Concurrent tasks upserting an alert for the same product can both pass
|
||||||
@@ -159,7 +157,7 @@ async def write_alert_ops(alert_ops: list[UpdateOne]):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await get_collection(ALERTS_COLLECTION_NAME).bulk_write(
|
await get_collection(alerts_collection_name).bulk_write(
|
||||||
alert_ops, ordered=False
|
alert_ops, ordered=False
|
||||||
)
|
)
|
||||||
except BulkWriteError as exc:
|
except BulkWriteError as exc:
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ from monitor_utils.config import (
|
|||||||
is_production,
|
is_production,
|
||||||
set_logger_levels,
|
set_logger_levels,
|
||||||
)
|
)
|
||||||
from monitor_utils.constants import (
|
from monitor_utils.constants import EXPECTED_TASK_ERRORS, LOGGING_LEVEL
|
||||||
EXPECTED_TASK_ERRORS,
|
|
||||||
LOGGING_LEVEL,
|
|
||||||
)
|
|
||||||
from monitor_utils.database import get_collection
|
from monitor_utils.database import get_collection
|
||||||
from monitor_utils.models import (
|
from monitor_utils.models import (
|
||||||
AvailabilityInfo,
|
AvailabilityInfo,
|
||||||
|
|||||||
Reference in new issue
Block a user