parent
5be011b8d9
commit
62989f4041
1 changed files with 52 additions and 35 deletions
|
@ -683,6 +683,17 @@ class OrderedSet:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
LOCK_FILE = 'artifacts/lock.lock'
|
||||||
|
|
||||||
|
if( os.path.exists(LOCK_FILE)):
|
||||||
|
log(f"Lock file exists at {LOCK_FILE}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
with open(LOCK_FILE, "w", encoding="utf-8") as f:
|
||||||
|
f.write(f"{datetime.now()}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
SEEN_URLS_FILE = "artifacts/seen_urls"
|
SEEN_URLS_FILE = "artifacts/seen_urls"
|
||||||
REPLIED_TOOT_SERVER_IDS_FILE = "artifacts/replied_toot_server_ids"
|
REPLIED_TOOT_SERVER_IDS_FILE = "artifacts/replied_toot_server_ids"
|
||||||
KNOWN_FOLLOWINGS_FILE = "artifacts/known_followings"
|
KNOWN_FOLLOWINGS_FILE = "artifacts/known_followings"
|
||||||
|
@ -727,3 +738,9 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
with open(REPLIED_TOOT_SERVER_IDS_FILE, "w", encoding="utf-8") as f:
|
with open(REPLIED_TOOT_SERVER_IDS_FILE, "w", encoding="utf-8") as f:
|
||||||
json.dump(dict(list(REPLIED_TOOT_SERVER_IDS.items())[-10000:]), f)
|
json.dump(dict(list(REPLIED_TOOT_SERVER_IDS.items())[-10000:]), f)
|
||||||
|
|
||||||
|
os.remove(LOCK_FILE)
|
||||||
|
|
||||||
|
except Exception as ex:
|
||||||
|
os.remove(LOCK_FILE)
|
||||||
|
raise
|
||||||
|
|
Loading…
Reference in a new issue