Source code for matcher.lim_matcher.config.config

"""Application config with global variables."""

import os
from dataclasses import dataclass
from pathlib import Path

DEFAULT_PORT = 5200

#: Redis consumer group for matching requests
CONSUMER_GROUP = os.environ.get("LIM_MATCHER_CONSUMER", "lim_matcher")
#: Matcher listener count
LISTENER_COUNT = 2
#: returned message number limit from Redis
MESSAGE_LIMIT = 20
#: receiving message timeout from Redis stream (milliseconds)
MESSAGE_TIMEOUT = 10
#: Redis lock name prefix
LOCK_PREFIX = os.environ.get("LIM_MATCHER_LOCK_PREFIX", "lim_matcher")
#: lock holding timeout, in seconds
LOCK_TIMEOUT = 60


[docs]@dataclass(slots=True) class MatcherConfig: """Indexed matcher configuration parameters.""" # (int): index search parameter efSearch: int # (int): descriptor version for matching. All loaded index must have descriptors of this version descriptorVersion: int # (bool): whether to perform index refreshing refreshIndexes: bool = None # (Path): index storage path storagePath: Path = None # (Path): index storage cache path cachePath: Path = None # (int): index reload interval, in seconds consumerGroup: str = CONSUMER_GROUP # (int): index reload interval, in seconds listenerCount: int = LISTENER_COUNT
#: Memory utilization limit, in percent MEMORY_USAGE_LIMIT = 80 #: Number of descriptors to add/remove per iteration when doing index refresh REFRESH_BATCH_SIZE = 10