-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undo write if it fails. #15
Conversation
Fixes #14.
Current coverage is
|
ssize = struct.pack(self.SIZE_FORMAT, len(string)) | ||
self.f.write(ssize) | ||
self.f.flush() | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we should catch only IOError here?
@ArturGaspar do you think you could come up with a test for this? |
@eliasdorneles A proper test would need a mock file that mimics the buffer mechanism and has a size limit. I'll try. |
@dangra would love to hear your feelings about this one. :) |
+1 I ❤️ it but I can have 🍶 only after a test case. |
Btw, queuelib is really to close 100% test coverage, would love anyone volunteer to get there. |
@shaneaevans commented (trough other channel) that |
Would it make sense to make flushing optional? |
Or should we just close this for now? |
Fixes #14.
The
flush()
is necessary because of the following scenario:It could however become a performance issue. Could be fixed by a file object that keeps a buffer in memory by itself and only calls write in KB-sized blocks.