attic
attic copied to clipboard
repository: two minor improvements
Two very minor improvements, for your reviewing pleasure.
- Clean up fds of segments we delete (during compaction)
- io.write_commit() already implies io.close_segment()
Nice findings!
One slight style improvement: use "is not None" rather than "!= None". As there is only one None object, you can compare based on object identity rather than object value.
also, while you are at it:
self.fds.pop(segment).close()
Search that line and see it should use same code as you did and rather check the return value of the pop operation before calling .close() on it. Maybe never a problem in practice, but the check should be made always, imho.
Thanks for the style hint!