Skip to content

Commit 3276434

Browse files
committed
add new SEARCH_BACKEND_TIMEOUT config option defaulted to 90sec
1 parent 34371d0 commit 3276434

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

archivebox/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
# SONIC
158158
'SONIC_COLLECTION': {'type': str, 'default': 'archivebox'},
159159
'SONIC_BUCKET': {'type': str, 'default': 'snapshots'},
160+
'SEARCH_BACKEND_TIMEOUT': {'type': int, 'default': 90},
160161
},
161162

162163
'DEPENDENCY_CONFIG': {

archivebox/search/backends/ripgrep.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from subprocess import run, PIPE
33
from typing import List, Generator
44

5-
from archivebox.config import ARCHIVE_DIR, RIPGREP_VERSION
5+
from archivebox.config import ARCHIVE_DIR, RIPGREP_VERSION, SEARCH_BACKEND_TIMEOUT
66
from archivebox.util import enforce_types
77

88
RG_IGNORE_EXTENSIONS = ('css','js','orig','svg')
@@ -32,7 +32,7 @@ def search(text: str) -> List[str]:
3232
from core.models import Snapshot
3333

3434
rg_cmd = ['rg', RG_ADD_TYPE, RG_IGNORE_ARGUMENTS, RG_DEFAULT_ARGUMENTS, RG_REGEX_ARGUMENT, text, str(ARCHIVE_DIR)]
35-
rg = run(rg_cmd, stdout=PIPE, stderr=PIPE, timeout=60)
35+
rg = run(rg_cmd, stdout=PIPE, stderr=PIPE, timeout=SEARCH_BACKEND_TIMEOUT)
3636
file_paths = [p.decode() for p in rg.stdout.splitlines()]
3737
timestamps = set()
3838
for path in file_paths:

0 commit comments

Comments
 (0)