Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(checkout-page): Calculate final amount in cart #1256

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from celery_app.app import celery_app as celery # noqa: F401
from celery_app.config import CeleryQueues
from seer.automation.autofix.tasks import check_and_mark_recent_autofix_runs
from seer.automation.tasks import delete_data_for_ttl, raise_an_exception
from seer.automation.tasks import buggy_code, delete_data_for_ttl
from seer.configuration import AppConfig
from seer.dependency_injection import inject, injected

Expand All @@ -28,7 +28,7 @@ def setup_periodic_tasks(sender, config: AppConfig = injected, **kwargs):
# TODO remove this task, it's just for testing in prod; throws an error every minute
sender.add_periodic_task(
crontab(minute="*", hour="*"),
raise_an_exception.signature(kwargs={}, queue=CeleryQueues.DEFAULT),
buggy_code.signature(kwargs={}, queue=CeleryQueues.DEFAULT),
name="Intentionally raise an error",
)

Expand Down
18 changes: 10 additions & 8 deletions src/seer/automation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@


@celery_app.task(time_limit=30)
def raise_an_exception():
import random

for i in range(10):
random_int = random.randint(0, 2)

result = 5 / random_int
logger.info(f"Result of 5 divided by {random_int} is {result}")
def buggy_code():
user_data = [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": "25"},
{"name": "Charlie", "age": None},
{"name": "David", "age": 40},
]

for user in user_data:
print(user["age"] * 12) # type: ignore[index]


@celery_app.task(time_limit=30)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_detected_celery_jobs():
"seer.automation.codegen.unittest_step.unittest_task",
"seer.automation.tasks.delete_data_for_ttl",
"seer.smoke_test.smoke_test",
"seer.automation.tasks.raise_an_exception", # TODO remove this once testing in prod is done
"seer.automation.tasks.buggy_code", # TODO remove this once testing in prod is done
]
)

Expand Down
Loading