- Since 2.3.2 invokeai stores the next PNG file's numeric prefix in a
file named `.next_prefix` in the outputs directory. This avoids the
overhead of doing a directory listing to find out what file number
comes next.
- The code uses advisory locking to prevent corruption of this file in
the event that multiple invokeai's try to access it simultaneously,
but some users have experienced corruption of the file nevertheless.
- This PR addresses the problem by detecting a potentially corrupted
`.next_prefix` file and falling back to the directory listing method.
A fixed version of the file is then written out.
- Closes#3001