Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

feat: [default polling to 10 seconds from 5 minutes; add configurable value] (FF-2686) #60

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The `init` function accepts the following optional configuration arguments.
| ------ | ----- | ----- | ----- |
| **`assignment_logger`** | [AssignmentLogger](https://github.com/Eppo-exp/python-sdk/blob/ebc1a0b781769fe9d2e2be6fc81779eb8685a6c7/eppo_client/assignment_logger.py#L6-L10) | A callback that sends each assignment to your data warehouse. Required only for experiment analysis. See [example](#assignment-logger) below. | `None` |
| **`is_graceful_mode`** | bool | When true, gracefully handles all exceptions within the assignment function and returns the default value. | `True` |

| **`poll_interval_seconds`** | int | The interval in seconds at which the SDK polls for configuration updates. | `10` |

## Assignment logger

Expand Down
7 changes: 4 additions & 3 deletions eppo_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from eppo_client.configuration_requestor import (
ExperimentConfigurationRequestor,
)
from eppo_client.constants import POLL_INTERVAL_MILLIS, POLL_JITTER_MILLIS
from eppo_client.constants import POLL_JITTER_SECONDS, POLL_INTERVAL_SECONDS
from eppo_client.models import VariationType
from eppo_client.poller import Poller
from eppo_client.sharders import MD5Sharder
Expand All @@ -33,13 +33,14 @@ def __init__(
config_requestor: ExperimentConfigurationRequestor,
assignment_logger: AssignmentLogger,
is_graceful_mode: bool = True,
poll_interval_seconds: int = POLL_INTERVAL_SECONDS,
):
self.__config_requestor = config_requestor
self.__assignment_logger = assignment_logger
self.__is_graceful_mode = is_graceful_mode
self.__poller = Poller(
interval_millis=POLL_INTERVAL_MILLIS,
jitter_millis=POLL_JITTER_MILLIS,
interval_millis=poll_interval_seconds * 1000,
jitter_millis=POLL_JITTER_SECONDS * 1000,
callback=config_requestor.fetch_and_store_configurations,
)
self.__poller.start()
Expand Down
1 change: 0 additions & 1 deletion eppo_client/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from eppo_client.assignment_logger import AssignmentLogger
from eppo_client.base_model import SdkBaseModel

from eppo_client.validation import validate_not_blank


Expand Down
6 changes: 2 additions & 4 deletions eppo_client/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# poller
SECOND_MILLIS = 1000
MINUTE_MILLIS = 60 * SECOND_MILLIS
POLL_JITTER_MILLIS = 30 * SECOND_MILLIS
POLL_INTERVAL_MILLIS = 5 * MINUTE_MILLIS
POLL_JITTER_SECONDS = 2
POLL_INTERVAL_SECONDS = 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to do 30 like our other SDKs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

golang is ten seconds - is 30 standard?

2 changes: 1 addition & 1 deletion eppo_client/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.0"
__version__ = "3.5.0"
Loading