Skip to content
Snippets Groups Projects
Commit f12917b8 authored by Andreas Valder's avatar Andreas Valder
Browse files

reduced load produced by workers

parent 2e021a88
Branches
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ api = WorkerApi(config['API']['BASE'],config['API']['KEY']) ...@@ -38,7 +38,7 @@ api = WorkerApi(config['API']['BASE'],config['API']['KEY'])
threading.Thread(target=run_scheduler, daemon=True).start() threading.Thread(target=run_scheduler, daemon=True).start()
@sched_func(5) @sched_func(15)
def ping_website_for_host(): def ping_website_for_host():
# ping so the website knows our host is still alive # ping so the website knows our host is still alive
if not api.worker_ping(): if not api.worker_ping():
...@@ -58,7 +58,8 @@ while True: ...@@ -58,7 +58,8 @@ while True:
continue continue
j = api.worker_schedule(config['JOBS']['TYPES']) j = api.worker_schedule(config['JOBS']['TYPES'])
if not j: if not j:
time.sleep(1) time.sleep(30)
continue continue
print("started jobid %i"%j['id']) print("started jobid %i"%j['id'])
procs.append(subprocess.Popen(['./worker.py', str(j['id']), str(j['type']), str(j['priority']) , str(j['data']) ] )) procs.append(subprocess.Popen(['./worker.py', str(j['id']), str(j['type']), str(j['priority']) , str(j['data']) ] ))
time.sleep(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment