Skip to content
Open
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions dash/background_callback/managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def get_updated_props(self, key):
raise NotImplementedError

def build_cache_key(self, fn, args, cache_args_to_ignore, triggered):
fn_source = inspect.getsource(fn)
try:
fn_source = inspect.getsource(fn)
fn_str = fn_source
except OSError: # pylint: disable=too-broad-exception
fn_str = getattr(fn, "__name__", "")

if not isinstance(cache_args_to_ignore, (list, tuple)):
cache_args_to_ignore = [cache_args_to_ignore]
Expand All @@ -69,7 +73,7 @@ def build_cache_key(self, fn, args, cache_args_to_ignore, triggered):
arg for i, arg in enumerate(args) if i not in cache_args_to_ignore
]

hash_dict = dict(args=args, fn_source=fn_source, triggered=triggered)
hash_dict = dict(args=args, fn_source=fn_str, triggered=triggered)

if self.cache_by is not None:
# Caching enabled
Expand Down