cog
18052e3c - refactor(weights): defer tmp.Close in atomicWriteFile (#2987)

Commit
17 days ago
refactor(weights): defer tmp.Close in atomicWriteFile (#2987) * refactor(weights): defer tmp.Close in atomicWriteFile Move tmp.Close into the deferred cleanup so every error path closes the file without repeating the call. Keep an explicit close before os.Rename on the success path: close can surface a deferred Sync failure, and we want to fail before committing a possibly-corrupt file. Addresses post-merge review feedback on #2974: https://github.com/replicate/cog/pull/2974#discussion_r3174631434 * chore: Apply suggestions from code review Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --------- Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com> Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Author
Parents
Loading