attic icon indicating copy to clipboard operation
attic copied to clipboard

repository: two minor improvements

Open sourcejedi opened this issue 10 years ago • 3 comments

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()

sourcejedi avatar Aug 11 '15 21:08 sourcejedi

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.

ThomasWaldmann avatar Aug 11 '15 23:08 ThomasWaldmann

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.

ThomasWaldmann avatar Aug 11 '15 23:08 ThomasWaldmann

Thanks for the style hint!

sourcejedi avatar Aug 12 '15 10:08 sourcejedi