mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-17 16:44:26 -04:00
add new SEARCH_BACKEND_TIMEOUT config option defaulted to 90sec
This commit is contained in:
parent
34371d027a
commit
32764347ce
2 changed files with 3 additions and 2 deletions
|
@ -157,6 +157,7 @@ CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
||||||
# SONIC
|
# SONIC
|
||||||
'SONIC_COLLECTION': {'type': str, 'default': 'archivebox'},
|
'SONIC_COLLECTION': {'type': str, 'default': 'archivebox'},
|
||||||
'SONIC_BUCKET': {'type': str, 'default': 'snapshots'},
|
'SONIC_BUCKET': {'type': str, 'default': 'snapshots'},
|
||||||
|
'SEARCH_BACKEND_TIMEOUT': {'type': int, 'default': 90},
|
||||||
},
|
},
|
||||||
|
|
||||||
'DEPENDENCY_CONFIG': {
|
'DEPENDENCY_CONFIG': {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
from subprocess import run, PIPE
|
from subprocess import run, PIPE
|
||||||
from typing import List, Generator
|
from typing import List, Generator
|
||||||
|
|
||||||
from archivebox.config import ARCHIVE_DIR, RIPGREP_VERSION
|
from archivebox.config import ARCHIVE_DIR, RIPGREP_VERSION, SEARCH_BACKEND_TIMEOUT
|
||||||
from archivebox.util import enforce_types
|
from archivebox.util import enforce_types
|
||||||
|
|
||||||
RG_IGNORE_EXTENSIONS = ('css','js','orig','svg')
|
RG_IGNORE_EXTENSIONS = ('css','js','orig','svg')
|
||||||
|
@ -32,7 +32,7 @@ def search(text: str) -> List[str]:
|
||||||
from core.models import Snapshot
|
from core.models import Snapshot
|
||||||
|
|
||||||
rg_cmd = ['rg', RG_ADD_TYPE, RG_IGNORE_ARGUMENTS, RG_DEFAULT_ARGUMENTS, RG_REGEX_ARGUMENT, text, str(ARCHIVE_DIR)]
|
rg_cmd = ['rg', RG_ADD_TYPE, RG_IGNORE_ARGUMENTS, RG_DEFAULT_ARGUMENTS, RG_REGEX_ARGUMENT, text, str(ARCHIVE_DIR)]
|
||||||
rg = run(rg_cmd, stdout=PIPE, stderr=PIPE, timeout=60)
|
rg = run(rg_cmd, stdout=PIPE, stderr=PIPE, timeout=SEARCH_BACKEND_TIMEOUT)
|
||||||
file_paths = [p.decode() for p in rg.stdout.splitlines()]
|
file_paths = [p.decode() for p in rg.stdout.splitlines()]
|
||||||
timestamps = set()
|
timestamps = set()
|
||||||
for path in file_paths:
|
for path in file_paths:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue