Browse Source

Track the last reflex run time (#4045)

Elijah Ahianyo 7 months ago
parent
commit
12d73e4167
2 changed files with 11 additions and 0 deletions
  1. 3 0
      reflex/utils/build.py
  2. 8 0
      reflex/utils/prerequisites.py

+ 3 - 0
reflex/utils/build.py

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

+ 8 - 0
reflex/utils/prerequisites.py

@@ -131,6 +131,14 @@ def get_or_set_last_reflex_version_check_datetime():
     return last_version_check_datetime
     return last_version_check_datetime
 
 
 
 
+def set_last_reflex_run_time():
+    """Set the last Reflex run time."""
+    path_ops.update_json_file(
+        get_web_dir() / constants.Reflex.JSON,
+        {"last_reflex_run_datetime": str(datetime.now())},
+    )
+
+
 def check_node_version() -> bool:
 def check_node_version() -> bool:
     """Check the version of Node.js.
     """Check the version of Node.js.