Sentry Issue: [POSTHOG-3ES](https://sentry.io/organizations/posthog/issues/2590699112/?referrer=github_integration)

```
TypeError: '>=' not supported between instances of 'str' and 'int'
  File "posthog/celery.py", line 271, in calculate_cohort
    calculate_cohorts()
  File "posthog/tasks/calculate_cohort.py", line 25, in calculate_cohorts
    Cohort.objects.filter(
  File "django/db/models/query.py", line 296, in __getitem__
    (k.stop is None or k.stop >= 0))), \
```
posthog/settings.py
TRUST_ALL_PROXIES = os.getenv("TRUST_ALL_PROXIES", False)
if IS_BEHIND_PROXY:
    USE_X_FORWARDED_HOST = True
    SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
    if not TRUST_ALL_PROXIES and not TRUSTED_PROXIES:
        print_warning(
            (
                "️You indicated your instance is behind a proxy (IS_BEHIND_PROXY env var),",
                " but you haven't configured any trusted proxies. See",
                " https://posthog.com/docs/configuring-posthog/running-behind-proxy for details.",
            )
        )
# IP Block settings
ALLOWED_IP_BLOCKS = get_list(os.getenv("ALLOWED_IP_BLOCKS", ""))
# Clickhouse Settings
CLICKHOUSE_TEST_DB = "posthog_test"
CLICKHOUSE_HOST = os.getenv("CLICKHOUSE_HOST", "localhost")
CLICKHOUSE_USER = os.getenv("CLICKHOUSE_USER", "default")
CLICKHOUSE_PASSWORD = os.getenv("CLICKHOUSE_PASSWORD", "")
CLICKHOUSE_DATABASE = CLICKHOUSE_TEST_DB if TEST else os.getenv("CLICKHOUSE_DATABASE", "default")
CLICKHOUSE_CLUSTER = os.getenv("CLICKHOUSE_CLUSTER", "posthog")
CLICKHOUSE_CA = os.getenv("CLICKHOUSE_CA", None)
CLICKHOUSE_SECURE = get_from_env("CLICKHOUSE_SECURE", not TEST and not DEBUG, type_cast=str_to_bool)
CLICKHOUSE_VERIFY = get_from_env("CLICKHOUSE_VERIFY", True, type_cast=str_to_bool)
CLICKHOUSE_REPLICATION = get_from_env("CLICKHOUSE_REPLICATION", False, type_cast=str_to_bool)
CLICKHOUSE_ENABLE_STORAGE_POLICY = get_from_env("CLICKHOUSE_ENABLE_STORAGE_POLICY", False, type_cast=str_to_bool)
CLICKHOUSE_ASYNC = get_from_env("CLICKHOUSE_ASYNC", False, type_cast=str_to_bool)
CLICKHOUSE_CONN_POOL_MIN = get_from_env("CLICKHOUSE_CONN_POOL_MIN", 20, type_cast=int)
CLICKHOUSE_CONN_POOL_MAX = get_from_env("CLICKHOUSE_CONN_POOL_MAX", 1000, type_cast=int)
_clickhouse_http_protocol = "http://"