2024-11-10 14:34:08 +00:00
|
|
|
from datetime import timedelta
|
|
|
|
|
2022-12-31 13:18:27 +00:00
|
|
|
from django.apps import AppConfig
|
2024-11-10 14:34:08 +00:00
|
|
|
from django.utils.timezone import now
|
2022-12-31 13:18:27 +00:00
|
|
|
|
|
|
|
|
2023-01-19 19:35:25 +00:00
|
|
|
class GamesConfig(AppConfig):
|
2022-12-31 13:18:27 +00:00
|
|
|
default_auto_field = "django.db.models.BigAutoField"
|
2023-01-19 19:35:25 +00:00
|
|
|
name = "games"
|
2024-11-10 14:34:08 +00:00
|
|
|
|
|
|
|
def ready(self):
|
2024-11-10 22:39:03 +00:00
|
|
|
from django_q.models import Schedule
|
|
|
|
from django_q.tasks import schedule
|
|
|
|
|
2024-11-10 14:34:08 +00:00
|
|
|
if not Schedule.objects.filter(name="Update converted prices").exists():
|
|
|
|
schedule(
|
2024-11-10 22:39:03 +00:00
|
|
|
"games.convert_price.update_converted_prices",
|
2024-11-10 14:34:08 +00:00
|
|
|
name="Update converted prices",
|
2024-11-10 22:39:03 +00:00
|
|
|
schedule_type=Schedule.HOURLY,
|
|
|
|
next_run=now() + timedelta(seconds=30),
|
2024-11-10 14:34:08 +00:00
|
|
|
)
|