Skip to content

Commit

Permalink
Fix google#694 - only check debug mode for has served traffic check
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen committed Jul 30, 2024
1 parent c0d2c4d commit 00618f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mesop/runtime/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from mesop.exceptions import MesopDeveloperException, MesopUserException
from mesop.key import Key
from mesop.security.security_policy import SecurityPolicy
from mesop.utils import colab_utils
from mesop.utils.backoff import exponential_backoff

from .context import Context
Expand Down Expand Up @@ -63,13 +62,15 @@ def context(self) -> Context:

def create_context(self) -> Context:
# If running in prod mode, *always* enable the has served traffic safety check.
# If running in debug mode, only enable the has served traffic safety check if
# app is not running in IPython / notebook environments.
# If running in debug mode, *disable* the has served traffic safety check.
#
# We don't want to break iterative development where notebook app developers
# will want to register pages after traffic has been served.
# Unlike CLI (w/ hot reload), in notebook envs, runtime is *not* reset.
if not self.debug_mode or not colab_utils.is_running_ipython():
#
# For unclear reasons detecting `colab_utils.is_running_ipython` does
# *not* work here.
if not self.debug_mode:
self._has_served_traffic = True
if len(self._state_classes) == 0:
states = {EmptyState: EmptyState()}
Expand Down

0 comments on commit 00618f7

Please sign in to comment.