pchr8 / up_crawler

Script that downloads articles from Ukrainska Pravda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve tags_map writing and interruptions logic by writing to a temp file and then moving to real location

pchr8 opened this issue · comments

Problem: Ctrl-C and similar interruptions happen often when writing the tags map, corrupting the json file.
Current solution: catch Ctrl-C exceptions and finish writing to file if it happens
Better solution: write to a temp file (nothing lost if it gets interrupted) and then move to real location (atomic operation)

(ty CH)