AsyncOpTracker, get_metadata_pool, norm_path, connect_to_filesystem, \
disconnect_from_filesystem
from .metrics.cache import (
- CACHE_TTL_SECS, COMPLETE_CACHE_MAX, lru_cache_timeout, PARTIAL_CACHE_MAX,
+ COMPLETE_CACHE_MAX, lru_cache_timeout, PARTIAL_CACHE_MAX,
metrics_for_dir_and_peers, try_get_from_complete)
from .metrics import load as metrics_load
from .exception import MirrorException
return me.args[0], '', me.args[1]
@lru_cache_timeout(
- lambda self, *_args, **_kwargs: CACHE_TTL_SECS,
+ lambda self, *_args, **_kwargs: self.mgr.get_module_option(
+ 'snapshot_mirror_metrics_cache_ttl'),
COMPLETE_CACHE_MAX)
def sync_stat_complete_cache(self, filesystem):
"""Load all directories and all peers for a filesystem from omap.
self.get_filesystem_peers(filesystem))
@lru_cache_timeout(
- lambda self, *_args, **_kwargs: CACHE_TTL_SECS,
+ lambda self, *_args, **_kwargs: self.mgr.get_module_option(
+ 'snapshot_mirror_metrics_cache_ttl'),
PARTIAL_CACHE_MAX)
def sync_stat_partial_cache(self, filesystem, dir_path, peer_ids):
"""Load sync-stat omap keys for one directory and a peer set.
class Module(MgrModule):
CLICommand = MirroringCLICommand
- MODULE_OPTIONS: List[Option] = []
+ MODULE_OPTIONS: List[Option] = [
+ Option(
+ 'snapshot_mirror_metrics_cache_ttl',
+ type='secs',
+ default=15,
+ desc='TTL for cached fs snapshot mirror status omap metrics',
+ runtime=True,
+ ),
+ ]
NOTIFY_TYPES = [NotifyType.fs_map]
def __init__(self, *args, **kwargs):