19 lines
709 B
Python
19 lines
709 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Optional real Redis wake-up smoke; external Redis required."""
|
||
|
|
# Allow direct `python scripts/name.py` from a fresh source checkout.
|
||
|
|
import sys as _sys
|
||
|
|
from pathlib import Path as _Path
|
||
|
|
_sys.path.insert(0, str(_Path(__file__).resolve().parents[1]))
|
||
|
|
import os
|
||
|
|
import time
|
||
|
|
from app import redis_signal
|
||
|
|
|
||
|
|
if not os.environ.get('SITEFORGE_REDIS_URL'):
|
||
|
|
raise SystemExit('Set SITEFORGE_REDIS_URL for real Redis smoke')
|
||
|
|
if not redis_signal.notify():
|
||
|
|
raise SystemExit('Redis notification failed')
|
||
|
|
start=time.monotonic()
|
||
|
|
redis_signal.wait(0.1)
|
||
|
|
assert time.monotonic()-start < 4, 'Wakeup not consumed promptly'
|
||
|
|
print('PASS: Redis notification and worker wait against configured Redis')
|