Skip to content

Commit

Permalink
Merged in backlog/per-user-schema-cache (pull request #238)
Browse files Browse the repository at this point in the history
Backlog/per user schema cache

Approved-by: Henrik Norin
Approved-by: Lluis Casals
  • Loading branch information
hdd committed Sep 21, 2020
2 parents e02c453 + 507a8a7 commit 743dc53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
13 changes: 9 additions & 4 deletions doc/release/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ Release Notes
.. release:: Upcoming

.. change:: changed
:tags: Documentation

Fix references to new python 3k support.
:ref:`installing`.
:tags: Session, cache

Schema cache is now saved per user, to avoid permissions conflicts on
multi user Os.

.. change:: new
:tags: Session, requests

Added new parameter *timeout* to :class:`Session` with default value
of 60 seconds to avoid infinity request on sudden disconnection.

.. change:: changed
:tags: Documentation

Fix references to new python 3k support.
:ref:`installing`.

.. change:: new
:tags: Documentation

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def run_tests(self):
'clique >= 1.2.0, < 2',
'websocket-client >= 0.40.0, < 1',
'future >=0.16.0, < 1',
'six >= 1, < 2'
'six >= 1, < 2',
'appdirs >=1, <2'
],
tests_require=[
'pytest >= 2.7, < 3',
Expand Down
4 changes: 3 additions & 1 deletion source/ftrack_api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import requests.auth
import arrow
import clique
import appdirs

import ftrack_api
import ftrack_api.exception
Expand Down Expand Up @@ -275,8 +276,9 @@ def __init__(
# rebuilding types)?
if schema_cache_path is not False:
if schema_cache_path is None:
schema_cache_path = appdirs.user_cache_dir()
schema_cache_path = os.environ.get(
'FTRACK_API_SCHEMA_CACHE_PATH', tempfile.gettempdir()
'FTRACK_API_SCHEMA_CACHE_PATH', schema_cache_path
)

schema_cache_path = os.path.join(
Expand Down
1 change: 0 additions & 1 deletion test/unit/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,6 @@ def test_rollback_entity_deletion(session, new_user):
# Caching
# ------------------------------------------------------------------------------


def test_get_entity_bypassing_cache(session, user, mocker):
'''Retrieve an entity by type and id bypassing cache.'''
mocker.patch.object(session, 'call', wraps=session.call)
Expand Down

0 comments on commit 743dc53

Please sign in to comment.