Repository: Netflix/consoleme
File: consoleme/celery/celery_tasks.py (Python)

Code before:
    "cache_s3_buckets_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_s3_buckets_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_sqs_queues_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_sqs_queues_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_sns_topics_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_sns_topics_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_audit_table_details": {
        "task": "consoleme.celery.celery_tasks.cache_audit_table_details",
        "options": {"expires": 300},
        "schedule": schedule_5_minutes,
    },
    "get_iam_access_key_id": {
        "task": "consoleme.celery.celery_tasks.get_inventory_of_iam_keys",
        "options": {"expires": 300},
        "schedule": schedule_24_hours,
    },
    "get_iam_roles_quota": {
        "task": "consoleme.celery.celery_tasks.get_iam_role_limit",
        "options": {"expires": 300},
        "schedule": schedule_24_hours,
    },
}

if internal_celery_tasks and isinstance(internal_celery_tasks, dict):
    schedule = {**schedule, **internal_celery_tasks}

app.conf.beat_schedule = schedule
app.conf.timezone = "UTC"


Review comment (refactor):
Can you make the function name and this name the same? For example either call this entry `get_iam_role_limit` or rename the function to `get_iam_roles_quota`. This gives us fewer layers of abstraction and makes it easier for someone to understand if they come here to read this code.

Code after:
        "task": "consoleme.celery.celery_tasks.cache_roles_across_accounts",
        "options": {"expires": 180},
        "schedule": schedule_45_minute,
    },
    "clear_old_redis_iam_cache": {
        "task": "consoleme.celery.celery_tasks.clear_old_redis_iam_cache",
        "options": {"expires": 180},
        "schedule": schedule_6_hours,
    },
    "cache_policies_table_details": {
        "task": "consoleme.celery.celery_tasks.cache_policies_table_details",
        "options": {"expires": 1000},
        "schedule": schedule_45_minute,
    },
    "report_celery_last_success_metrics": {
        "task": "consoleme.celery.celery_tasks.report_celery_last_success_metrics",
        "options": {"expires": 60},
        "schedule": schedule_minute,
    },
    "cache_managed_policies_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_managed_policies_across_accounts",
        "options": {"expires": 1000},
        "schedule": schedule_45_minute,
    },
    "cache_s3_buckets_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_s3_buckets_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_sqs_queues_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_sqs_queues_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_sns_topics_across_accounts": {
        "task": "consoleme.celery.celery_tasks.cache_sns_topics_across_accounts",
        "options": {"expires": 300},
        "schedule": schedule_45_minute,
    },
    "cache_audit_table_details": {
        "task": "consoleme.celery.celery_tasks.cache_audit_table_details",
        "options": {"expires": 300},
        "schedule": schedule_5_minutes,
    },
    "get_iam_access_key_id": {
        "task": "consoleme.celery.celery_tasks.get_inventory_of_iam_keys",
        "options": {"expires": 300},
        "schedule": schedule_24_hours,
    },
    "get_iam_role_limit": {
        "task": "consoleme.celery.celery_tasks.get_iam_role_limit",