Skip to content

Commit

Permalink
use time.time() instead for delta
Browse files Browse the repository at this point in the history
  • Loading branch information
alemsh committed Oct 16, 2023
1 parent 69736fa commit 3ad99ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions condor_history_to_prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ def read_from_schedd(schedd_ad, history=False, constraint='true', projection=[],
exit()

while True:
start = datetime.now()
start = time.time()
for collector in args:
query_collector(collector, metrics, last_job)

delta = datetime.now() - start
delta = time.time() - start
# sleep for interval minus scrape duration
# if scrape duration was longer than interval, run right away
if delta.seconds < options.interval:
time.sleep(options.interval - delta.seconds)
if delta < options.interval:
time.sleep(options.interval - delta)

0 comments on commit 3ad99ed

Please sign in to comment.