Track the last reflex run time

This commit is contained in:
Elijah 2024-10-03 13:36:15 +00:00
parent f3be9a3305
commit 34652bfd67
2 changed files with 18 additions and 0 deletions

View File

@ -236,6 +236,9 @@ def setup_frontend(
# Set the environment variables in client (env.json).
set_env_json()
# update the last reflex run time.
prerequisites.set_last_reflex_run_time()
# Disable the Next telemetry.
if disable_telemetry:
processes.new_process(

View File

@ -132,6 +132,21 @@ def get_or_set_last_reflex_version_check_datetime():
return last_version_check_datetime
def set_last_reflex_run_time():
"""Set the last Reflex run time.
Returns:
The last time the reflex app was started.
"""
reflex_json_file = get_web_dir() / constants.Reflex.JSON
if not reflex_json_file.exists():
return
data = json.loads(reflex_json_file.read_text())
data.update({"last_reflex_run_datetime": str(datetime.now())})
path_ops.update_json_file(reflex_json_file, data)
def check_node_version() -> bool:
"""Check the version of Node.js.