-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
36 lines (29 loc) · 805 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import time
from healthcheck_decorator.healthcheck import healthcheck
from healthcheck_decorator.monitor import HealthcheckedFunctionMonitor
@healthcheck
def test():
print('This is test function')
@healthcheck(key='TEST-KEY')
def test_key():
print('This is test function with key name on decorator')
@healthcheck
def test_function_not_working():
print('This function never runs')
def checker():
monitor = HealthcheckedFunctionMonitor()
keys = monitor.get()
cache_client = monitor.get_cache_client()
for key in keys:
if cache_client.get(key):
print(f'{key} ok')
else:
print(f'{key} not working')
if __name__ == '__main__':
test()
time.sleep(1)
test_key()
time.sleep(1)
checker()
while True:
pass