mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Improve singlefile-storage warnings
This commit is contained in:
parent
c2fac4ac6f
commit
c18dde68f4
1 changed files with 6 additions and 9 deletions
|
|
@ -36,14 +36,9 @@ class SingleFileStorage(Storage):
|
||||||
.. versionadded:: 0.1.6
|
.. versionadded:: 0.1.6
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This storage has many raceconditions, which basically means that you
|
This storage is very slow, and that is unlikely to change. You should
|
||||||
should avoid changing the file with another program (or even running
|
consider using :py:class:`vdirsyncer.storage.FilesystemStorage` if it
|
||||||
any programs which might modify the file) while vdirsyncer is running.
|
fits your usecase.
|
||||||
|
|
||||||
Also it is currently very slow, so you should consider limiting the
|
|
||||||
amount of items you synchronize. In combination with
|
|
||||||
:py:class:`vdirsyncer.storage.CaldavStorage` this can be achieved via
|
|
||||||
the ``start_date`` and ``end_date`` parameters.
|
|
||||||
|
|
||||||
:param path: The filepath to the file to be written to.
|
:param path: The filepath to the file to be written to.
|
||||||
:param encoding: Which encoding the file should use. Defaults to UTF-8.
|
:param encoding: Which encoding the file should use. Defaults to UTF-8.
|
||||||
|
|
@ -169,7 +164,9 @@ class SingleFileStorage(Storage):
|
||||||
if self._last_mtime is not None and \
|
if self._last_mtime is not None and \
|
||||||
self._last_mtime != os.path.getmtime(self.path):
|
self._last_mtime != os.path.getmtime(self.path):
|
||||||
raise exceptions.PreconditionFailed(
|
raise exceptions.PreconditionFailed(
|
||||||
'Some other program modified the file {r!}'.format(self.path))
|
'Some other program modified the file {r!}. Re-run the '
|
||||||
|
'synchronization and make sure absolutely no other program is '
|
||||||
|
'writing into the same file.'.format(self.path))
|
||||||
text = join_collection(
|
text = join_collection(
|
||||||
(item.raw for item, etag in itervalues(self._items)),
|
(item.raw for item, etag in itervalues(self._items)),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue