diff --git a/.sampo/changesets/ancient-queen-tursas.md b/.sampo/changesets/ancient-queen-tursas.md new file mode 100644 index 00000000..d3e94302 --- /dev/null +++ b/.sampo/changesets/ancient-queen-tursas.md @@ -0,0 +1,5 @@ +--- +pypi/posthog: patch +--- + +Increase the default background flush interval to 5 seconds diff --git a/posthog/client.py b/posthog/client.py index 20d1a9f9..800cc577 100644 --- a/posthog/client.py +++ b/posthog/client.py @@ -185,7 +185,7 @@ def __init__( send=True, on_error=None, flush_at=100, - flush_interval=0.5, + flush_interval=5.0, gzip=False, max_retries=3, sync_mode=False, diff --git a/posthog/consumer.py b/posthog/consumer.py index 6f0450f0..9f208662 100644 --- a/posthog/consumer.py +++ b/posthog/consumer.py @@ -40,7 +40,7 @@ def __init__( flush_at=100, host=None, on_error=None, - flush_interval=0.5, + flush_interval=5.0, gzip=False, retries=10, timeout=15, diff --git a/references/public_api_snapshot.txt b/references/public_api_snapshot.txt index cab2d743..e6645985 100644 --- a/references/public_api_snapshot.txt +++ b/references/public_api_snapshot.txt @@ -744,8 +744,8 @@ class posthog.ai.types.ToolInProgress class posthog.args.OptionalCaptureArgs class posthog.args.OptionalSetArgs class posthog.bucketed_rate_limiter.BucketedRateLimiter(bucket_size: Number, refill_rate: Number, refill_interval_seconds: Number, on_bucket_rate_limited: Optional[Callable[[Hashable], None]] = None, clock: Callable[[], float] = time.monotonic) -class posthog.client.Client(project_api_key: str, host=None, debug=False, max_queue_size=10000, send=True, on_error=None, flush_at=100, flush_interval=0.5, gzip=False, max_retries=3, sync_mode=False, timeout=15, thread=1, poll_interval=30, personal_api_key=None, disabled=False, disable_geoip=True, is_server=True, historical_migration=False, feature_flags_request_timeout_seconds=3, super_properties=None, enable_exception_autocapture=False, log_captured_exceptions=False, project_root=None, privacy_mode=False, before_send=None, flag_fallback_cache_url=None, enable_local_evaluation=True, flag_definition_cache_provider: Optional[FlagDefinitionCacheProvider] = None, capture_exception_code_variables=False, code_variables_mask_patterns=None, code_variables_ignore_patterns=None, in_app_modules: list[str] | None = None, enable_exception_autocapture_rate_limiting=False, exception_autocapture_bucket_size=ExceptionCapture.DEFAULT_BUCKET_SIZE, exception_autocapture_refill_rate=ExceptionCapture.DEFAULT_REFILL_RATE, exception_autocapture_refill_interval_seconds=ExceptionCapture.DEFAULT_REFILL_INTERVAL_SECONDS, _dedicated_ai_endpoint=False) -class posthog.consumer.Consumer(queue, api_key, flush_at=100, host=None, on_error=None, flush_interval=0.5, gzip=False, retries=10, timeout=15, historical_migration=False, dedicated_ai_endpoint=False) +class posthog.client.Client(project_api_key: str, host=None, debug=False, max_queue_size=10000, send=True, on_error=None, flush_at=100, flush_interval=5.0, gzip=False, max_retries=3, sync_mode=False, timeout=15, thread=1, poll_interval=30, personal_api_key=None, disabled=False, disable_geoip=True, is_server=True, historical_migration=False, feature_flags_request_timeout_seconds=3, super_properties=None, enable_exception_autocapture=False, log_captured_exceptions=False, project_root=None, privacy_mode=False, before_send=None, flag_fallback_cache_url=None, enable_local_evaluation=True, flag_definition_cache_provider: Optional[FlagDefinitionCacheProvider] = None, capture_exception_code_variables=False, code_variables_mask_patterns=None, code_variables_ignore_patterns=None, in_app_modules: list[str] | None = None, enable_exception_autocapture_rate_limiting=False, exception_autocapture_bucket_size=ExceptionCapture.DEFAULT_BUCKET_SIZE, exception_autocapture_refill_rate=ExceptionCapture.DEFAULT_REFILL_RATE, exception_autocapture_refill_interval_seconds=ExceptionCapture.DEFAULT_REFILL_INTERVAL_SECONDS, _dedicated_ai_endpoint=False) +class posthog.consumer.Consumer(queue, api_key, flush_at=100, host=None, on_error=None, flush_interval=5.0, gzip=False, retries=10, timeout=15, historical_migration=False, dedicated_ai_endpoint=False) class posthog.contexts.ContextScope(parent=None, fresh: bool = False, capture_exceptions: bool = True, client: Optional[Client] = None) class posthog.exception_capture.ExceptionCapture(client: Client, rate_limiting_enabled=False, bucket_size=DEFAULT_BUCKET_SIZE, refill_rate=DEFAULT_REFILL_RATE, refill_interval_seconds=DEFAULT_REFILL_INTERVAL_SECONDS) class posthog.exception_utils.AnnotatedValue(value, metadata) diff --git a/sdk_compliance_adapter/adapter.py b/sdk_compliance_adapter/adapter.py index e0ed1b4b..032dea68 100644 --- a/sdk_compliance_adapter/adapter.py +++ b/sdk_compliance_adapter/adapter.py @@ -225,7 +225,7 @@ def init(): api_key = data.get("api_key") host = data.get("host") flush_at = data.get("flush_at", 100) - flush_interval_ms = data.get("flush_interval_ms", 500) + flush_interval_ms = data.get("flush_interval_ms", 5000) max_retries = data.get("max_retries", 3) enable_compression = data.get("enable_compression", False)