• Alain Takoudjou's avatar
    slapos.grid.promise: prevent json file corruption while updating data · d42de18b
    Alain Takoudjou authored
    history and statistics files are sometimes corrupted because of invalid json
    
    We do 2 things to improve this:
     1. we use json.load to read the previous file (this will detect if the file is corrupted)
     2. we use json.dump to write the entire file at once in a temporary file and then we move this file to be atomic.
    
    Probably this will consume more resources.
    
    See merge request !728
    d42de18b
__init__.py 33.1 KB