Skip to content

Commit

Permalink
feat(*): Remove force_config_scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet committed Feb 1, 2024
1 parent ce344b5 commit 621cc31
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/cscapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class CAPIClientConfig:
max_retries: int = 3
latency_offset: int = 10
retry_delay: int = 5
force_config_scenario: bool = True


def _group_signals_by_machine_id(
Expand All @@ -67,7 +66,6 @@ def _group_signals_by_machine_id(
class CAPIClient:
def __init__(self, storage: StorageInterface, config: CAPIClientConfig):
self.storage = storage
self.force_config_scenario = config.force_config_scenario
self.scenarios = ",".join(sorted(config.scenarios))
self.latency_offset = config.latency_offset
self.max_retries = config.max_retries
Expand All @@ -86,9 +84,6 @@ def has_valid_scenarios(self, machine: MachineModel) -> bool:
if len(stored_scenarios) == 0:
return False

if not self.force_config_scenario:
return True

return current_scenarios == stored_scenarios

def add_signals(self, signals: List[SignalModel]):
Expand Down Expand Up @@ -234,9 +229,7 @@ def _clear_all_signals(self):
self.storage.delete_signals(signals)

def _refresh_machine_token(self, machine: MachineModel) -> MachineModel:
machine.scenarios = (
self.scenarios if self.force_config_scenario else machine.scenarios
)
machine.scenarios = self.scenarios
resp = self.http_client.post(
self._get_url(CAPI_WATCHER_LOGIN_ENDPOINT),
json={
Expand Down

0 comments on commit 621cc31

Please sign in to comment.