Skip to content
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

use shutils.move instead of os.rename #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dogpile_filesystem/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import tempfile
import time

from shutil import copyfileobj
from shutil import copyfileobj, move

from dogpile.cache.api import CacheBackend, NO_VALUE, CachedValue

Expand Down Expand Up @@ -166,8 +166,8 @@ def set(self, key, value):
pickle.dump(metadata, metadata_file, pickle.HIGHEST_PROTOCOL)

with self._get_rw_lock(key):
os.rename(metadata_file.name, self._file_path_metadata(key))
os.rename(payload_file_path, self._file_path_payload(key))
move(metadata_file.name, self._file_path_metadata(key))
move(payload_file_path, self._file_path_payload(key))
os.utime(self._file_path_metadata(key), (now_timestamp, now_timestamp))
os.utime(self._file_path_payload(key), (now_timestamp, now_timestamp))

Expand Down