opentimestamps/opentimestamps-server

os.fdatasync on Mac OS

RCasatta opened this issue · 2 comments

There is an issue running otsd on Mac OS because the os.fdatasync function is not supported on the platform.

This is just for reference, it's not very useful to have the server running on Mac OS

here is the stack trace:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/casatta/workspaces/github/RCasatta/opentimestamps-server/otsserver/calendar.py", line 192, in __loop
    self.calendar.submit(digests_commitment)
  File "/Users/casatta/workspaces/github/RCasatta/opentimestamps-server/otsserver/calendar.py", line 98, in submit
    self.journal.submit(commitment.msg)
  File "/Users/casatta/workspaces/github/RCasatta/opentimestamps-server/otsserver/calendar.py", line 74, in submit
    os.fdatasync(self.append_fd.fileno())
AttributeError: module 'os' has no attribute 'fdatasync'

Well, I'd be happy to accept a pull-req that uses fsync() instead if fdatasync() doesn't exist!

Everything fdatasync() does is done by fsync() anyway, just at slightly higher cost.