/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/utils
import time def check_lock(check_lock_period: int, lock_file): if not lock_file.exists(): lock_file.parent.mkdir(parents=True, exist_ok=True) lock_file.write_text(str(time.time() + check_lock_period)) return 0 if (time_left := is_period_passed(check_lock_period, lock_file)) <= 0: lock_file.write_text(str(time.time() + check_lock_period)) return 0 else: return time_left def is_period_passed(period, lock_file): try: when_to_run = float(lock_file.read_text()) except (FileNotFoundError, ValueError): return 0 return when_to_run - time.time()
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
_shutil.py
Edit
antivirus_mode.py
Edit
async_utils.py
Edit
benchmark.py
Edit
buffer.py
Edit
check_db.py
Edit
check_lock.py
Edit
cli.py
Edit
common.py
Edit
completions.py
Edit
config.py
Edit
cronjob.py
Edit
doctor.py
Edit
fd_ops.py
Edit
hyperscan.py
Edit
importer.py
Edit
ipecho.py
Edit
json.py
Edit
kwconfig.py
Edit
net_transport.py
Edit
parsers.py
Edit
resource_limits.py
Edit
safe_fileops.py
Edit
safe_sequence.py
Edit
serialization.py
Edit
sshutil.py
Edit
subprocess.py
Edit
support.py
Edit
threads.py
Edit
validate.py
Edit
whmcs.py
Edit
wordpress_mu_plugin.py
Edit