I’m getting likes, so I’m assuming they’re helpful to someone
Here is a nice decorator I use to wrap my client side server calls.
It’s really reduced the amount of AppOfflineError’s my user’s get because of spotty cell service.
from functools import wraps from anvil_extras import MessagePill def retry_on_offline(fn): @wraps(fn) def wrapped(*args,**kwargs): attempts = 0 while attempts < 5: try: return fn(*args,**kwargs) except anvil.server.AppOfflineError as e: attempts += 1 if attempts == 5: message = MessagePill.MessagePill(level="error",message = "Application is Offline, You your changes may not save until you get better service.") alert(message,title="Warning",large=True) return wrapped