(20250102) Receipt add failures will be reported to Telegram.
This commit is contained in:
@@ -175,7 +175,8 @@ class CoreBaseModel:
|
|||||||
retry_count: int = 1,
|
retry_count: int = 1,
|
||||||
backoff_seconds: float = 0.5,
|
backoff_seconds: float = 0.5,
|
||||||
backoff_multiplier: float = 1.1,
|
backoff_multiplier: float = 1.1,
|
||||||
session_token: str = None
|
session_token: str = None,
|
||||||
|
alert_on_all_failures: bool = False
|
||||||
):
|
):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -209,7 +210,8 @@ class CoreBaseModel:
|
|||||||
retry_count = retry_count,
|
retry_count = retry_count,
|
||||||
backoff_seconds = backoff_seconds,
|
backoff_seconds = backoff_seconds,
|
||||||
backoff_multiplier = backoff_multiplier,
|
backoff_multiplier = backoff_multiplier,
|
||||||
session_token = session_token
|
session_token = session_token,
|
||||||
|
alert_on_all_failures = alert_on_all_failures
|
||||||
)
|
)
|
||||||
|
|
||||||
# If the database call succeeded, cache the response:
|
# If the database call succeeded, cache the response:
|
||||||
@@ -227,7 +229,8 @@ class CoreBaseModel:
|
|||||||
retry_count: int = 1,
|
retry_count: int = 1,
|
||||||
backoff_seconds: float = 0.5,
|
backoff_seconds: float = 0.5,
|
||||||
backoff_multiplier: float = 1.1,
|
backoff_multiplier: float = 1.1,
|
||||||
session_token: str = None
|
session_token: str = None,
|
||||||
|
alert_on_all_failures: bool = False
|
||||||
):
|
):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -241,6 +244,7 @@ class CoreBaseModel:
|
|||||||
:param session_token: A session token to share with the tech module when alerts need to be sent out for any
|
:param session_token: A session token to share with the tech module when alerts need to be sent out for any
|
||||||
occurrence of exceptions. If this is passed, the tech module will be able to tell you which user faced the
|
occurrence of exceptions. If this is passed, the tech module will be able to tell you which user faced the
|
||||||
issue.
|
issue.
|
||||||
|
:param alert_on_all_failures: If set to True, all failure (even non-exceptions) will be reported.
|
||||||
:return: The response from the stored procedure.
|
:return: The response from the stored procedure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -262,8 +266,14 @@ class CoreBaseModel:
|
|||||||
if not success or not self._debug_only_errors:
|
if not success or not self._debug_only_errors:
|
||||||
self._printer(proc_name, proc_args, success, exception, message)
|
self._printer(proc_name, proc_args, success, exception, message)
|
||||||
|
|
||||||
# Send an alert out on exceptions:
|
# Send an alert out on exceptions or failures (if asked):
|
||||||
if exception is not None:
|
if (
|
||||||
|
exception is not None or
|
||||||
|
(
|
||||||
|
not success and
|
||||||
|
alert_on_all_failures
|
||||||
|
)
|
||||||
|
):
|
||||||
|
|
||||||
# Format the message in Markdown format:
|
# Format the message in Markdown format:
|
||||||
exception_string = str(exception).replace("`", "'")
|
exception_string = str(exception).replace("`", "'")
|
||||||
|
|||||||
@@ -348,7 +348,8 @@ class PaymentsController(CoreAuthTokenController, ABC):
|
|||||||
retry_count = 1,
|
retry_count = 1,
|
||||||
backoff_seconds = 0.5,
|
backoff_seconds = 0.5,
|
||||||
backoff_multiplier = 1.1,
|
backoff_multiplier = 1.1,
|
||||||
session_token = session_token
|
session_token = session_token,
|
||||||
|
alert_on_all_failures = True
|
||||||
)
|
)
|
||||||
|
|
||||||
print("RECEIPT ADD JSON:", json.to_string(sql_json, default = str))
|
print("RECEIPT ADD JSON:", json.to_string(sql_json, default = str))
|
||||||
|
|||||||
Reference in New Issue
Block a user