Skip to content

Instantly share code, notes, and snippets.

@whardier
Created June 22, 2020 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whardier/4f9c182a16d0cb4f26e898e8e143cbc7 to your computer and use it in GitHub Desktop.
Save whardier/4f9c182a16d0cb4f26e898e8e143cbc7 to your computer and use it in GitHub Desktop.
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