Skip to content

Commit

Permalink
FIX: Long wait for shutdown
Browse files Browse the repository at this point in the history
When trying to quickly shutdown the program, it did not work. Now we are only sleeping two seconds instead of 60 (worst case)
  • Loading branch information
d-Rickyy-b committed May 7, 2019
1 parent 222e3d9 commit 55bb18d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pastepwn/scraping/pastebin/pastebinscraper.py
Expand Up @@ -165,12 +165,13 @@ def start(self, paste_queue):
self.running = False
break

# check if time since last
current_time = int(time.time())
diff = current_time - self._last_scrape_time

# if the last scraping happened less than 60 seconds ago,
# wait until the 60 seconds passed
if diff < 60:
sleep_time = 60 - diff
time.sleep(sleep_time)
while self.running:
current_time = int(time.time())
diff = current_time - self._last_scrape_time

if diff > 60:
break

# if the last scraping happened less than 60 seconds ago,
# wait 2 seconds and check again
time.sleep(2)

0 comments on commit 55bb18d

Please sign in to comment.