Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 7 additions & 7 deletions examples/gunicorn/gunicorn_conf.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import logging

import prefab_cloud_python
from prefab_cloud_python import Options
import sdk_reforge
from sdk_reforge import Options


def on_starting(server):
logging.warning("Starting server")
prefab_cloud_python.set_options(Options(collect_sync_interval=5))
sdk_reforge.set_options(Options(collect_sync_interval=5))
logging.warning(
f"current value of 'foobar' is {prefab_cloud_python.get_client().get('foobar')}"
f"current value of 'foobar' is {sdk_reforge.get_client().get('foobar')}"
)


def post_worker_init(worker):
# Initialize the client for each worker
prefab_cloud_python.reset_instance()
sdk_reforge.reset_instance()


def on_exit(server):
logging.warning("shutting down prefab")
prefab_cloud_python.reset_instance()
logging.warning("shutting down reforge")
sdk_reforge.reset_instance()
4 changes: 2 additions & 2 deletions examples/gunicorn/test_app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import prefab_cloud_python
import sdk_reforge


def app(environ, start_response):
output = f"value of 'test.config' is {prefab_cloud_python.get_client().config_client().get('test.config')}".encode()
output = f"value of 'test.config' is {sdk_reforge.get_client().config_client().get('test.config')}".encode()
start_response(
"200 OK", [("Content-Type", "text/plain"), ("Content-Length", str(len(output)))]
)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_sse_connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test_backoff_on_failed_response(self, mock_sleep):
mock_sleep.assert_has_calls(expected_calls, any_order=False)

self.api_client.resilient_request.assert_called_with(
"/api/v1/sse/config",
headers={"x-prefab-start-at-id": "123", "accept": "text/event-stream"},
"/api/v2/sse/config",
headers={"Last-Event-ID": "123", "accept": "text/event-stream"},
stream=True,
auth=("authuser", "test_api_key"),
timeout=(5, 60),
Expand Down Expand Up @@ -110,8 +110,8 @@ def test_backoff_on_too_quick_connection(self, mock_sleep, mock_timing):
mock_sleep.assert_has_calls(expected_calls, any_order=False)

self.api_client.resilient_request.assert_called_with(
"/api/v1/sse/config",
headers={"x-prefab-start-at-id": "123", "accept": "text/event-stream"},
"/api/v2/sse/config",
headers={"Last-Event-ID": "123", "accept": "text/event-stream"},
stream=True,
auth=("authuser", "test_api_key"),
timeout=(5, 60),
Expand Down Expand Up @@ -149,8 +149,8 @@ def test_backoff_on_general_exception(self, mock_sleep):

mock_sleep.assert_has_calls(expected_calls, any_order=False)
self.api_client.resilient_request.assert_called_with(
"/api/v1/sse/config",
headers={"x-prefab-start-at-id": "123", "accept": "text/event-stream"},
"/api/v2/sse/config",
headers={"Last-Event-ID": "123", "accept": "text/event-stream"},
stream=True,
auth=("authuser", "test_api_key"),
timeout=(5, 60),
Expand Down Expand Up @@ -202,8 +202,8 @@ def test_backoff_reset_on_successful_connection(self, mock_sleep, mock_timing):

mock_sleep.assert_has_calls(expected_calls, any_order=False)
self.api_client.resilient_request.assert_called_with(
"/api/v1/sse/config",
headers={"x-prefab-start-at-id": "123", "accept": "text/event-stream"},
"/api/v2/sse/config",
headers={"Last-Event-ID": "123", "accept": "text/event-stream"},
stream=True,
auth=("authuser", "test_api_key"),
timeout=(5, 60),
Expand Down
Loading