diff options
author | raylu <raylu@gridium.com> | 2013-10-23 02:10:43 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-24 01:51:15 -0700 |
commit | 4f07a9e4ae2feed1f67d3435723e24cb1a6531bf (patch) | |
tree | 64713b5d215b0970ef72016aae3bc1c61ab32c45 | |
parent | 9b824bff6529d19bae86fa840f66479e22dabffb (diff) | |
download | ykill-4f07a9e4ae2feed1f67d3435723e24cb1a6531bf.tar.xz |
up sleep time to 12 seconds
also fix sleep bug
-rwxr-xr-x | importer.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/importer.py b/importer.py index d735c22..f2202e9 100755 --- a/importer.py +++ b/importer.py @@ -80,9 +80,11 @@ def main(): if last_kill_id is not None: path += '/beforeKillID/' + str(last_kill_id) now = time.time() - if now - last_request_time < 10: - print('sleeping', 10 - (now - last_request_time)) - time.sleep(10 - (now - last_request_time)) + if now - last_request_time < 12: + sleep_secs = 12 - (now - last_request_time) + print('sleeping', sleep_secs) + time.sleep(sleep_secs) + last_request_time = time.time() try: r = rs.get('https://zkillboard.com' + path) kills = r.json() @@ -98,7 +100,6 @@ def main(): break db.conn.commit() last_kill_id = kills[-1]['killID'] - last_request_time = now if __name__ == '__main__': main() |