From 191b772882a836a03ce6fd8d5280c2fb145f8bc0 Mon Sep 17 00:00:00 2001 From: Marco Zeisler Date: Mon, 12 Apr 2021 21:34:11 +0200 Subject: [PATCH] added circuitbreaker example; --- components/i_feed/requirements.txt | 2 ++ components/i_feed/traffic_light.py | 7 ++++++- components/i_feed/vehicle.py | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 components/i_feed/requirements.txt diff --git a/components/i_feed/requirements.txt b/components/i_feed/requirements.txt new file mode 100644 index 0000000..29a1d83 --- /dev/null +++ b/components/i_feed/requirements.txt @@ -0,0 +1,2 @@ +circuitbreaker # fault tolerance + diff --git a/components/i_feed/traffic_light.py b/components/i_feed/traffic_light.py index 4640904..a0efe5c 100644 --- a/components/i_feed/traffic_light.py +++ b/components/i_feed/traffic_light.py @@ -1 +1,6 @@ -# TODO +from circuitbreaker import circuit + + +@circuit(failure_threshold=10, expected_exception=ConnectionError) +def external_call(): + ... diff --git a/components/i_feed/vehicle.py b/components/i_feed/vehicle.py index 4640904..a0efe5c 100644 --- a/components/i_feed/vehicle.py +++ b/components/i_feed/vehicle.py @@ -1 +1,6 @@ -# TODO +from circuitbreaker import circuit + + +@circuit(failure_threshold=10, expected_exception=ConnectionError) +def external_call(): + ...