Created
June 22, 2020 02:46
-
-
Save whardier/4f9c182a16d0cb4f26e898e8e143cbc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import json | |
import pathlib | |
configurable_path = pathlib.Path('/tmp/configurable.json') | |
configurable = {} | |
counter = 0 | |
def something(): | |
global counter | |
counter += 1 | |
print(time.time(), counter) | |
while True: | |
if configurable_path.exists(): | |
with configurable_path.open() as fd: | |
configurable = json.load(fd) | |
something() | |
time.sleep(configurable.get('the_while_loop_delay', 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment